bpo-46066: Check DeprecationWarning in test_typing (GH-31428)
This commit is contained in:
parent
7a4791e036
commit
0a8a8e7454
@ -4585,8 +4585,6 @@ class TypedDictTests(BaseTestCase):
|
|||||||
|
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
TypedDict(_typename='Emp', name=str, id=int)
|
TypedDict(_typename='Emp', name=str, id=int)
|
||||||
with self.assertRaises(TypeError):
|
|
||||||
TypedDict('Emp', _fields={'name': str, 'id': int})
|
|
||||||
|
|
||||||
def test_typeddict_errors(self):
|
def test_typeddict_errors(self):
|
||||||
Emp = TypedDict('Emp', {'name': str, 'id': int})
|
Emp = TypedDict('Emp', {'name': str, 'id': int})
|
||||||
@ -4598,6 +4596,9 @@ class TypedDictTests(BaseTestCase):
|
|||||||
isinstance(jim, Emp)
|
isinstance(jim, Emp)
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
issubclass(dict, Emp)
|
issubclass(dict, Emp)
|
||||||
|
# We raise a DeprecationWarning for the keyword syntax
|
||||||
|
# before the TypeError.
|
||||||
|
with self.assertWarns(DeprecationWarning):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
TypedDict('Hi', x=1)
|
TypedDict('Hi', x=1)
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user