https://github.com/python/cpython/commit/614c493406c3b6f805096d4e13fcc1a7fc506fef
commit: 614c493406c3b6f805096d4e13fcc1a7fc506fef
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: picnixz <[email protected]>
date: 2025-09-07T09:52:35Z
summary:

[3.13] gh-138584: Increase test coverage for `collections.UserList` (GH-138590) 
(#138611)

gh-138584: Increase test coverage for `collections.UserList` (GH-138590)

Some common tests in `test.list_tests.CommonTest` explicitly tested `list`
instead of testing the underlying list-like type defined in `type2test`.

---------
(cherry picked from commit d7b9ea5cab984497526fcc0b988e4eb5988c1e88)

Co-authored-by: dbXD320 <[email protected]>
Co-authored-by: Devansh Baghla <[email protected]>

files:
M Lib/test/list_tests.py

diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index dbc5ef4f9f2cd5..65dfa41b26e965 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -31,13 +31,13 @@ def test_init(self):
         self.assertEqual(a, b)
 
     def test_getitem_error(self):
-        a = []
+        a = self.type2test([])
         msg = "list indices must be integers or slices"
         with self.assertRaisesRegex(TypeError, msg):
             a['a']
 
     def test_setitem_error(self):
-        a = []
+        a = self.type2test([])
         msg = "list indices must be integers or slices"
         with self.assertRaisesRegex(TypeError, msg):
             a['a'] = "python"
@@ -558,7 +558,7 @@ def test_constructor_exception_handling(self):
         class F(object):
             def __iter__(self):
                 raise KeyboardInterrupt
-        self.assertRaises(KeyboardInterrupt, list, F())
+        self.assertRaises(KeyboardInterrupt, self.type2test, F())
 
     def test_exhausted_iterator(self):
         a = self.type2test([1, 2, 3])

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to