Skip to content

Commit 2012bb4

Browse files
committed
fix tests
1 parent 26f1c7c commit 2012bb4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Lib/annotationlib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ def get_annotations(
697697
# But if we didn't get it, we use __annotations__ instead.
698698
ann = _get_dunder_annotations(obj)
699699
return ann
700+
case Format.VALUE_WITH_FAKE_GLOBALS:
701+
raise ValueError("The VALUE_WITH_FAKE_GLOBALS format is for internal use only")
700702
case _:
701703
raise ValueError(f"Unsupported format {format!r}")
702704

Lib/test/test_annotationlib.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ def foo(a: int, b: str):
467467

468468
foo.__annotations__ = {"a": "foo", "b": "str"}
469469
for format in annotationlib.Format:
470+
if format is Format.VALUE_WITH_FAKE_GLOBALS:
471+
continue
470472
with self.subTest(format=format):
471473
self.assertEqual(
472474
annotationlib.get_annotations(foo, format=format),
@@ -778,6 +780,8 @@ def __annotations__(self):
778780

779781
wa = WeirdAnnotations()
780782
for format in Format:
783+
if format is Format.VALUE_WITH_FAKE_GLOBALS:
784+
continue
781785
with (
782786
self.subTest(format=format),
783787
self.assertRaisesRegex(

0 commit comments

Comments
 (0)