Skip to content

Commit 3d08f8f

Browse files
committed
Remove 'synthetic' test, make the regular test replace additional values
1 parent 57bfa41 commit 3d08f8f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Lib/test/test_annotationlib.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,21 +2048,14 @@ def test_evaluate_string_format(self):
20482048

20492049
def test_evaluate_string_format_extra_names(self):
20502050
# Test that internal extra_names are replaced when evaluating as strings
2051-
2052-
# As identifier
2053-
fr = ForwardRef("__annotationlib_name_1__")
2054-
fr.__extra_names__ = {"__annotationlib_name_1__": str}
2055-
self.assertEqual(fr.evaluate(format=Format.STRING), "str")
2056-
2057-
# Via AST visitor
2058-
def f(a: ref | str): ...
2051+
def f(a: unknown | str | int | list[str] | tuple[int, ...]): ...
20592052

20602053
fr = get_annotations(f, format=Format.FORWARDREF)['a']
20612054
# Test the cache is not populated before access
20622055
self.assertIsNone(fr.__resolved_str_cache__)
20632056

2064-
self.assertEqual(fr.evaluate(format=Format.STRING), "ref | str")
2065-
self.assertEqual(fr.__resolved_str_cache__, "ref | str")
2057+
self.assertEqual(fr.evaluate(format=Format.STRING), "unknown | str | int | list[str] | tuple[int, ...]")
2058+
self.assertEqual(fr.__resolved_str_cache__, "unknown | str | int | list[str] | tuple[int, ...]")
20662059

20672060
def test_evaluate_forwardref_format(self):
20682061
fr = ForwardRef("undef")

0 commit comments

Comments
 (0)