From: dbXD320 Date: Sun, 7 Sep 2025 08:53:22 +0000 (+0530) Subject: gh-138584: Increase test coverage for `collections.UserList` (#138590) X-Git-Tag: v3.15.0a1~460 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7b9ea5cab984497526fcc0b988e4eb5988c1e88;p=thirdparty%2FPython%2Fcpython.git gh-138584: Increase test coverage for `collections.UserList` (#138590) Some common tests in `test.list_tests.CommonTest` explicitly tested `list` instead of testing the underlying list-like type defined in `type2test`. --------- Co-authored-by: Devansh Baghla --- diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 68d6bad20942..e76f79c274e7 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -32,13 +32,13 @@ class CommonTest(seq_tests.CommonTest): 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" @@ -561,7 +561,7 @@ class CommonTest(seq_tests.CommonTest): 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])