Skip to content

Commit c98e556

Browse files
committed
test & lint
1 parent 32dde8e commit c98e556

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/test_typing_extensions.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8248,13 +8248,18 @@ def foo(a: int, b: str):
82488248

82498249
foo.__annotations__ = {"a": "foo", "b": "str"}
82508250
for format in Format:
8251-
if format is Format.VALUE_WITH_FAKE_GLOBALS:
8252-
continue
82538251
with self.subTest(format=format):
8254-
self.assertEqual(
8255-
get_annotations(foo, format=format),
8256-
{"a": "foo", "b": "str"},
8257-
)
8252+
if format is Format.VALUE_WITH_FAKE_GLOBALS:
8253+
with self.assertRaisesRegex(
8254+
ValueError,
8255+
"The VALUE_WITH_FAKE_GLOBALS format is for internal use only"
8256+
):
8257+
get_annotations(foo, format=format)
8258+
else:
8259+
self.assertEqual(
8260+
get_annotations(foo, format=format),
8261+
{"a": "foo", "b": "str"},
8262+
)
82588263

82598264
self.assertEqual(
82608265
get_annotations(foo, eval_str=True, locals=locals()),

src/typing_extensions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4186,7 +4186,9 @@ def get_annotations(obj, *, globals=None, locals=None, eval_str=False,
41864186
"""
41874187
format = Format(format)
41884188
if format is Format.VALUE_WITH_FAKE_GLOBALS:
4189-
raise ValueError("The VALUE_WITH_FAKE_GLOBALS format is for internal use only")
4189+
raise ValueError(
4190+
"The VALUE_WITH_FAKE_GLOBALS format is for internal use only"
4191+
)
41904192

41914193
if eval_str and format is not Format.VALUE:
41924194
raise ValueError("eval_str=True is only supported with format=Format.VALUE")

0 commit comments

Comments
 (0)