[3.14] gh-138584: Increase test coverage for collections.UserList (GH-138590) (#138612)

Co-authored-by: dbXD320 <devanshbaghla320@gmail.com>
Co-authored-by: Devansh Baghla <devanshbaghla34@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-09-07 12:42:19 +02:00 committed by GitHub
parent d36c9a8b50
commit 78ee486861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,13 +32,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"
@ -561,7 +561,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])