3030 (3 ,),
3131 id = 'inline import-import' ,
3232 ),
33+ pytest .param (
34+ 'if True: from async_timeout import timeout, other_name\n ' ,
35+ (3 , 11 ),
36+ id = 'inline async_timeout mixed imports' ,
37+ ),
3338 pytest .param (
3439 'import xml.etree.cElementTree' ,
3540 (3 ,),
4550 (3 , 9 ),
4651 id = 'skip rewriting of Callable in 3.9 since it is broken' ,
4752 ),
53+ pytest .param (
54+ 'from async_timeout import timeout, timeout_at\n ' ,
55+ (3 , 10 ),
56+ id = 'async_timeout timeout imports below 3.11' ,
57+ ),
4858 ),
4959)
5060def test_import_replaces_noop (s , min_version ):
@@ -77,6 +87,24 @@ def test_mock_noop_keep_mock():
7787 'from collections.abc import Mapping as MAP\n ' ,
7888 id = 'one-name replacement with alias' ,
7989 ),
90+ pytest .param (
91+ 'from async_timeout import timeout\n ' ,
92+ (3 , 11 ),
93+ 'from asyncio import timeout\n ' ,
94+ id = 'async_timeout timeout' ,
95+ ),
96+ pytest .param (
97+ 'from async_timeout import timeout as t\n ' ,
98+ (3 , 11 ),
99+ 'from asyncio import timeout as t\n ' ,
100+ id = 'async_timeout timeout alias' ,
101+ ),
102+ pytest .param (
103+ 'from async_timeout import timeout, timeout_at\n ' ,
104+ (3 , 11 ),
105+ 'from asyncio import timeout, timeout_at\n ' ,
106+ id = 'async_timeout timeout names' ,
107+ ),
80108 pytest .param (
81109 'from collections import Mapping, Sequence\n ' ,
82110 (3 ,),
@@ -90,6 +118,13 @@ def test_mock_noop_keep_mock():
90118 'from collections.abc import Mapping\n ' ,
91119 id = 'one name rewritten to new module' ,
92120 ),
121+ pytest .param (
122+ 'from async_timeout import timeout, other_name\n ' ,
123+ (3 , 11 ),
124+ 'from async_timeout import other_name\n '
125+ 'from asyncio import timeout\n ' ,
126+ id = 'async_timeout mixed imports' ,
127+ ),
93128 pytest .param (
94129 'from collections import Counter, Mapping' ,
95130 (3 ,),
0 commit comments