[Python-checkins] bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
miss-islington
webhook-mailer at python.org
Wed Feb 9 10:12:31 EST 2022
https://github.com/python/cpython/commit/d29bbc22b08551afce24e933f43bfcb6e980cb08
commit: d29bbc22b08551afce24e933f43bfcb6e980cb08
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-09T07:12:17-08:00
summary:
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
(cherry picked from commit d2d1d49eaccaa83eb8873ba15f2fc9562143bc56)
Co-authored-by: Nikita Sobolev <mail at sobolevn.me>
files:
M Lib/test/test_typing.py
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 62762418b3f4a..2842e28c5ab59 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -2650,6 +2650,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'))
More information about the Python-checkins
mailing list