Skip to content

Commit bde3765

Browse files
bpo-46685: cover TypeError of ForwardRef(1) in test_typing (GH-31223)
(cherry picked from commit d2d1d49) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 76b0727 commit bde3765

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
@@ -2455,6 +2455,10 @@ def test_forwardref_subclass_type_error(self):
24552455
with self.assertRaises(TypeError):
24562456
issubclass(int, fr)
24572457

2458+
def test_forwardref_only_str_arg(self):
2459+
with self.assertRaises(TypeError):
2460+
typing.ForwardRef(1) # only `str` type is allowed
2461+
24582462
def test_forward_equality(self):
24592463
fr = typing.ForwardRef('int')
24602464
self.assertEqual(fr, typing.ForwardRef('int'))

0 commit comments

Comments
 (0)