mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
[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 d7b9ea5cab)
Co-authored-by: dbXD320 <devanshbaghla320@gmail.com>
Co-authored-by: Devansh Baghla <devanshbaghla34@gmail.com>
This commit is contained in:
parent
e5bbcb1605
commit
614c493406
1 changed files with 3 additions and 3 deletions
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue