8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b563db commit 0058b82Copy full SHA for 0058b82
Lib/test/test_type_annotations.py
@@ -391,9 +391,20 @@ def test_future_annotations(self):
391
392
def f(x: int) -> int: pass
393
"""
394
- ns = run_code(textwrap.dedent(code))
+ ns = run_code(code)
395
f = ns["f"]
396
self.assertIsInstance(f.__annotate__, types.FunctionType)
397
annos = {"x": "int", "return": "int"}
398
self.assertEqual(f.__annotate__(inspect.VALUE), annos)
399
self.assertEqual(f.__annotations__, annos)
400
+
401
+ def test_name_clash_with_format(self):
402
+ # this test would fail if __annotate__'s parameter was called "format"
403
+ code = """
404
+ class format: pass
405
406
+ def f(x: format): pass
407
+ """
408
409
+ f = ns["f"]
410
+ self.assertEqual(f.__annotations__, {"x": ns["format"]})
0 commit comments