Skip to content

Commit d29bbc2

Browse files
bpo-46685: cover TypeError of ForwardRef(1) in test_typing (GH-31223)
(cherry picked from commit d2d1d49) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent c2735b7 commit d29bbc2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/test/test_typing.py

+4
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,10 @@ def test_forwardref_subclass_type_error(self):
26502650
with self.assertRaises(TypeError):
26512651
issubclass(int, fr)
26522652

2653+
def test_forwardref_only_str_arg(self):
2654+
with self.assertRaises(TypeError):
2655+
typing.ForwardRef(1) # only `str` type is allowed
2656+
26532657
def test_forward_equality(self):
26542658
fr = typing.ForwardRef('int')
26552659
self.assertEqual(fr, typing.ForwardRef('int'))

0 commit comments

Comments
 (0)