From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 9 Feb 2022 15:12:17 +0000 (-0800) Subject: bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223) X-Git-Tag: v3.10.3~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d29bbc22b08551afce24e933f43bfcb6e980cb08;p=thirdparty%2FPython%2Fcpython.git bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223) (cherry picked from commit d2d1d49eaccaa83eb8873ba15f2fc9562143bc56) Co-authored-by: Nikita Sobolev --- diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 62762418b3f4..2842e28c5ab5 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -2650,6 +2650,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'))