Skip to content

Commit

Permalink
bpo-46685: cover TypeError of ForwardRef(1) in test_typing (pyt…
Browse files Browse the repository at this point in the history
…honGH-31223)

(cherry picked from commit d2d1d49)

Co-authored-by: Nikita Sobolev <[email protected]>
  • Loading branch information
sobolevn authored and miss-islington committed Feb 9, 2022
1 parent 76b0727 commit 5ace575
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2455,6 +2455,10 @@ def test_forwardref_subclass_type_error(self):
with self.assertRaises(TypeError):
issubclass(int, fr)

def test_forwardref_only_str_arg(self):
with self.assertRaises(TypeError):
typing.ForwardRef(1) # only `str` type is allowed

def test_forward_equality(self):
fr = typing.ForwardRef('int')
self.assertEqual(fr, typing.ForwardRef('int'))
Expand Down

0 comments on commit 5ace575

Please sign in to comment.