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 <devanshbaghla34@gmail.com>
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user