File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Misc/NEWS.d/next/Core_and_Builtins Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -1172,20 +1172,21 @@ async def run():
11721172 def test_sync_anext_raises_exception (self ):
11731173 # See: https://github.com/python/cpython/issues/131670
11741174 msg = 'custom'
1175- for exc in [
1176- StopAsyncIteration ( msg ) ,
1177- StopIteration ( msg ) ,
1178- ValueError ( msg ) ,
1179- Exception ( msg ) ,
1175+ for exc_type in [
1176+ StopAsyncIteration ,
1177+ StopIteration ,
1178+ ValueError ,
1179+ Exception ,
11801180 ]:
1181+ exc = exc_type (msg )
11811182 with self .subTest (exc = exc ):
11821183 class A :
11831184 def __anext__ (self ):
11841185 raise exc
11851186
1186- with self .assertRaisesRegex (type ( exc ) , msg ):
1187+ with self .assertRaisesRegex (exc_type , msg ):
11871188 anext (A ())
1188- with self .assertRaisesRegex (type ( exc ) , msg ):
1189+ with self .assertRaisesRegex (exc_type , msg ):
11891190 anext (A (), 1 )
11901191
11911192 def test_async_gen_asyncio_anext_stopiteration (self ):
Original file line number Diff line number Diff line change 1- Fix :func: `anext ` failing on sync :meth: `~object.__anext__ ` that raises
2- :exc: `StopAsyncIteration `.
1+ Fix :func: `anext ` failing on sync :meth: `~object.__anext__ ` raising an exception.
You can’t perform that action at this time.
0 commit comments