bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)

This commit is contained in:
Nikita Sobolev 2022-02-09 17:23:07 +03:00 committed by GitHub
parent f71a69aa92
commit d2d1d49eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -2792,6 +2792,10 @@ class ForwardRefTests(BaseTestCase):
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'))