bpo-46066: Check DeprecationWarning in test_typing (GH-31428) · python/cpython@0a8a8e7 (original) (raw)

`@@ -4585,8 +4585,6 @@ def test_typeddict_create_errors(self):

`

4585

4585

``

4586

4586

`with self.assertRaises(TypeError):

`

4587

4587

`TypedDict(_typename='Emp', name=str, id=int)

`

4588

``

`-

with self.assertRaises(TypeError):

`

4589

``

`-

TypedDict('Emp', _fields={'name': str, 'id': int})

`

4590

4588

``

4591

4589

`def test_typeddict_errors(self):

`

4592

4590

`Emp = TypedDict('Emp', {'name': str, 'id': int})

`

`@@ -4598,8 +4596,11 @@ def test_typeddict_errors(self):

`

4598

4596

`isinstance(jim, Emp)

`

4599

4597

`with self.assertRaises(TypeError):

`

4600

4598

`issubclass(dict, Emp)

`

4601

``

`-

with self.assertRaises(TypeError):

`

4602

``

`-

TypedDict('Hi', x=1)

`

``

4599

`+

We raise a DeprecationWarning for the keyword syntax

`

``

4600

`+

before the TypeError.

`

``

4601

`+

with self.assertWarns(DeprecationWarning):

`

``

4602

`+

with self.assertRaises(TypeError):

`

``

4603

`+

TypedDict('Hi', x=1)

`

4603

4604

`with self.assertRaises(TypeError):

`

4604

4605

`TypedDict('Hi', [('x', int), ('y', 1)])

`

4605

4606

`with self.assertRaises(TypeError):

`