[Python-checkins] bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
corona10
webhook-mailer at python.org
Wed Feb 9 09:23:21 EST 2022
https://github.com/python/cpython/commit/d2d1d49eaccaa83eb8873ba15f2fc9562143bc56
commit: d2d1d49eaccaa83eb8873ba15f2fc9562143bc56
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-02-09T23:23:07+09:00
summary:
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
files:
M Lib/test/test_typing.py
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 78e58928332f0..6e2a2b1978ab4 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -2792,6 +2792,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