@@ -882,10 +882,12 @@ async def coro(self):
882882
883883class DeprecatedCoroTests (BaseTestCase ):
884884 def test_asyncio_iscoroutinefunction (self ):
885- self .assertFalse (asyncio .coroutines .iscoroutinefunction (func ))
886- self .assertFalse (asyncio .coroutines .iscoroutinefunction (Cls .func ))
887- self .assertTrue (asyncio .coroutines .iscoroutinefunction (coro ))
888- self .assertTrue (asyncio .coroutines .iscoroutinefunction (Cls .coro ))
885+ with warnings .catch_warnings ():
886+ warnings .simplefilter ("ignore" , DeprecationWarning )
887+ self .assertFalse (asyncio .coroutines .iscoroutinefunction (func ))
888+ self .assertFalse (asyncio .coroutines .iscoroutinefunction (Cls .func ))
889+ self .assertTrue (asyncio .coroutines .iscoroutinefunction (coro ))
890+ self .assertTrue (asyncio .coroutines .iscoroutinefunction (Cls .coro ))
889891
890892 @skipUnless (TYPING_3_12_ONLY or TYPING_3_13_0_RC , "inspect.iscoroutinefunction works differently on Python < 3.12" )
891893 def test_inspect_iscoroutinefunction (self ):
@@ -7209,7 +7211,7 @@ def test_cannot_instantiate_vars(self):
72097211
72107212 def test_bound_errors (self ):
72117213 with self .assertRaises (TypeError ):
7212- TypeVar ('X' , bound = Union )
7214+ TypeVar ('X' , bound = Optional )
72137215 with self .assertRaises (TypeError ):
72147216 TypeVar ('X' , str , float , bound = Employee )
72157217 with self .assertRaisesRegex (TypeError ,
@@ -8190,19 +8192,25 @@ def f2(a: "undefined"): # noqa: F821
81908192 get_annotations (f2 , format = Format .FORWARDREF ),
81918193 {"a" : "undefined" },
81928194 )
8193- self .assertEqual (get_annotations (f2 , format = 2 ), {"a" : "undefined" })
8195+ self .assertEqual (
8196+ get_annotations (f2 , format = Format .FORWARDREF .value ),
8197+ {"a" : "undefined" },
8198+ )
81948199
81958200 self .assertEqual (
81968201 get_annotations (f1 , format = Format .STRING ),
81978202 {"a" : "int" },
81988203 )
8199- self .assertEqual (get_annotations (f1 , format = 3 ), {"a" : "int" })
8204+ self .assertEqual (
8205+ get_annotations (f1 , format = Format .STRING .value ),
8206+ {"a" : "int" },
8207+ )
82008208
82018209 with self .assertRaises (ValueError ):
82028210 get_annotations (f1 , format = 0 )
82038211
82048212 with self .assertRaises (ValueError ):
8205- get_annotations (f1 , format = 4 )
8213+ get_annotations (f1 , format = 42 )
82068214
82078215 def test_custom_object_with_annotations (self ):
82088216 class C :
@@ -8240,6 +8248,8 @@ def foo(a: int, b: str):
82408248
82418249 foo .__annotations__ = {"a" : "foo" , "b" : "str" }
82428250 for format in Format :
8251+ if format is Format .VALUE_WITH_FAKE_GLOBALS :
8252+ continue
82438253 with self .subTest (format = format ):
82448254 self .assertEqual (
82458255 get_annotations (foo , format = format ),
0 commit comments