Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a8a8e7

Browse files
bpo-46066: Check DeprecationWarning in test_typing (GH-31428)
1 parent7a4791e commit0a8a8e7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎Lib/test/test_typing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4585,8 +4585,6 @@ def test_typeddict_create_errors(self):
45854585

45864586
withself.assertRaises(TypeError):
45874587
TypedDict(_typename='Emp',name=str,id=int)
4588-
withself.assertRaises(TypeError):
4589-
TypedDict('Emp',_fields={'name':str,'id':int})
45904588

45914589
deftest_typeddict_errors(self):
45924590
Emp=TypedDict('Emp', {'name':str,'id':int})
@@ -4598,8 +4596,11 @@ def test_typeddict_errors(self):
45984596
isinstance(jim,Emp)
45994597
withself.assertRaises(TypeError):
46004598
issubclass(dict,Emp)
4601-
withself.assertRaises(TypeError):
4602-
TypedDict('Hi',x=1)
4599+
# We raise a DeprecationWarning for the keyword syntax
4600+
# before the TypeError.
4601+
withself.assertWarns(DeprecationWarning):
4602+
withself.assertRaises(TypeError):
4603+
TypedDict('Hi',x=1)
46034604
withself.assertRaises(TypeError):
46044605
TypedDict('Hi', [('x',int), ('y',1)])
46054606
withself.assertRaises(TypeError):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp