Skip to content

Commit d2d1d49

Browse files
authored
bpo-46685: cover TypeError of ForwardRef(1) in test_typing (GH-31223)
1 parent f71a69a commit d2d1d49

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/test/test_typing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,6 +2792,10 @@ def test_forwardref_subclass_type_error(self):
27922792
with self.assertRaises(TypeError):
27932793
issubclass(int, fr)
27942794

2795+
def test_forwardref_only_str_arg(self):
2796+
with self.assertRaises(TypeError):
2797+
typing.ForwardRef(1) # only `str` type is allowed
2798+
27952799
def test_forward_equality(self):
27962800
fr = typing.ForwardRef('int')
27972801
self.assertEqual(fr, typing.ForwardRef('int'))

0 commit comments

Comments
 (0)