diff options
Diffstat (limited to 'Lib/test/list_tests.py')
-rw-r--r-- | Lib/test/list_tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 42e118b..9069337 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -30,6 +30,12 @@ class CommonTest(seq_tests.CommonTest): self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) + def test_getitem_error(self): + msg = "list indices must be integers or slices" + with self.assertRaisesRegex(TypeError, msg): + a = [] + a['a'] = "python" + def test_repr(self): l0 = [] l2 = [0, 1, 2] @@ -120,6 +126,10 @@ class CommonTest(seq_tests.CommonTest): a[-1] = 9 self.assertEqual(a, self.type2test([5,6,7,8,9])) + msg = "list indices must be integers or slices" + with self.assertRaisesRegex(TypeError, msg): + a['a'] = "python" + def test_delitem(self): a = self.type2test([0, 1]) del a[1] |