summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2022-02-20 01:44:51 (GMT)
committerGitHub <noreply@github.com>2022-02-20 01:44:51 (GMT)
commit0a8a8e7454c6565cf1554d5f23314e4c70960bcd (patch)
tree58363aae3df1013052d7062a23a09f5036ba3436
parent7a4791e03613bfbdc0d3ddfabfc0b59e6a6f7358 (diff)
downloadcpython-0a8a8e7454c6565cf1554d5f23314e4c70960bcd.zip
cpython-0a8a8e7454c6565cf1554d5f23314e4c70960bcd.tar.gz
cpython-0a8a8e7454c6565cf1554d5f23314e4c70960bcd.tar.bz2
bpo-46066: Check DeprecationWarning in test_typing (GH-31428)
-rw-r--r--Lib/test/test_typing.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index b38e27c..dc1514d 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -4585,8 +4585,6 @@ class TypedDictTests(BaseTestCase):
with self.assertRaises(TypeError):
TypedDict(_typename='Emp', name=str, id=int)
- with self.assertRaises(TypeError):
- TypedDict('Emp', _fields={'name': str, 'id': int})
def test_typeddict_errors(self):
Emp = TypedDict('Emp', {'name': str, 'id': int})
@@ -4598,8 +4596,11 @@ class TypedDictTests(BaseTestCase):
isinstance(jim, Emp)
with self.assertRaises(TypeError):
issubclass(dict, Emp)
- with self.assertRaises(TypeError):
- TypedDict('Hi', x=1)
+ # We raise a DeprecationWarning for the keyword syntax
+ # before the TypeError.
+ with self.assertWarns(DeprecationWarning):
+ with self.assertRaises(TypeError):
+ TypedDict('Hi', x=1)
with self.assertRaises(TypeError):
TypedDict('Hi', [('x', int), ('y', 1)])
with self.assertRaises(TypeError):