gh-95144: Improve error message of ... in None (GH-119888)

This commit is contained in:
Zachary Ware 2024-07-12 11:34:17 -05:00 committed by GitHub
parent 65fededf9c
commit dc03ce797a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 5 deletions

View file

@ -24,8 +24,11 @@ class TestContains(unittest.TestCase):
self.assertNotIn(0, b)
self.assertIn(1, c)
self.assertNotIn(0, c)
self.assertRaises(TypeError, lambda: 1 in a)
self.assertRaises(TypeError, lambda: 1 not in a)
msg = "argument of type 'base_set' is not a container or iterable"
with self.assertRaisesRegex(TypeError, msg):
1 in a
with self.assertRaisesRegex(TypeError, msg):
1 not in a
# test char in string
self.assertIn('c', 'abc')