Skip to content

Commit 837a441

Browse files
committed
YAPFd
1 parent b486dc3 commit 837a441

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
5151
"""
5252

53-
install_requires=[
53+
install_requires = [
5454
"trio",
5555
"async_generator >= 1.6",
5656
]

tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@ def all_tasks(loop=None):
3636
if not hasattr(asyncio, 'create_task'):
3737

3838
if hasattr(asyncio.events, 'get_running_loop'):
39+
3940
def create_task(coro):
4041
loop = asyncio.events.get_running_loop()
4142
return loop.create_task(coro)
4243
else:
44+
4345
def create_task(coro):
4446
loop = asyncio.events._get_running_loop()
4547
return loop.create_task(coro)
4648

4749
asyncio.create_task = create_task
4850

51+
4952
@pytest.fixture
5053
async def loop():
5154
async with trio_asyncio.open_loop() as loop:

tests/python/test_tasks.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,13 +2049,12 @@ def test_create_task_with_noncoroutine(self):
20492049
for x in range(2):
20502050
try:
20512051
self.new_task(self.loop, 123)
2052-
except (TypeError,AssertionError):
2052+
except (TypeError, AssertionError):
20532053
pass
20542054
else:
20552055
self.fail("Error not raised")
20562056

20572057
def test_create_task_with_oldstyle_coroutine(self):
2058-
20592058
@asyncio.coroutine
20602059
def coro():
20612060
pass
@@ -2071,7 +2070,6 @@ def coro():
20712070
self.loop.run_until_complete(task)
20722071

20732072
def test_create_task_with_async_function(self):
2074-
20752073
async def coro():
20762074
pass
20772075

@@ -2097,7 +2095,6 @@ def test_create_task_with_asynclike_function(self):
20972095
self.assertEqual(self.loop.run_until_complete(task), 42)
20982096

20992097
def test_bare_create_task(self):
2100-
21012098
async def inner():
21022099
return 1
21032100

@@ -2177,8 +2174,7 @@ def test_context_3(self):
21772174
async def sub(num):
21782175
for i in range(10):
21792176
cvar.set(num + i)
2180-
await asyncio.sleep(
2181-
random.uniform(0.001, 0.05), loop=loop)
2177+
await asyncio.sleep(random.uniform(0.001, 0.05), loop=loop)
21822178
self.assertEqual(cvar.get(), num + i)
21832179

21842180
async def main():
@@ -2662,8 +2658,7 @@ def test_run_coroutine_threadsafe_task_factory_exception(self):
26622658
def task_factory(loop, coro):
26632659
raise NameError
26642660

2665-
run = self.loop.run_in_executor(
2666-
None, lambda: self.target(advance_coro=True))
2661+
run = self.loop.run_in_executor(None, lambda: self.target(advance_coro=True))
26672662

26682663
# Set exception handler
26692664
callback = test_utils.MockCallback()
@@ -2711,6 +2706,7 @@ def coro():
27112706
self.loop.run_until_complete(coro())
27122707
self.assertEqual(result, 11)
27132708

2709+
27142710
class CompatibilityTests(test_utils.TestCase):
27152711
# Tests for checking a bridge between old-styled coroutines
27162712
# and async/await syntax
@@ -2726,7 +2722,6 @@ def tearDown(self):
27262722
super().tearDown()
27272723

27282724
def test_yield_from_awaitable(self):
2729-
27302725
@asyncio.coroutine
27312726
def coro():
27322727
yield from asyncio.sleep(0, loop=self.loop)
@@ -2736,7 +2731,6 @@ def coro():
27362731
self.assertEqual('ok', result)
27372732

27382733
def test_await_old_style_coro(self):
2739-
27402734
@asyncio.coroutine
27412735
def coro1():
27422736
return 'ok1'
@@ -2745,6 +2739,7 @@ def coro1():
27452739
def coro2():
27462740
yield from asyncio.sleep(0, loop=self.loop)
27472741
return 'ok2'
2742+
27482743
async def inner():
27492744
return await asyncio.gather(coro1(), coro2(), loop=self.loop)
27502745

@@ -2754,7 +2749,8 @@ async def inner():
27542749
@unittest.skipIf(sys.version_info < (3, 7), 'need python 3.7 for asyncio.run')
27552750
def test_debug_mode_interop(self):
27562751
# https://bugs.python.org/issue32636
2757-
code = textwrap.dedent("""
2752+
code = textwrap.dedent(
2753+
"""
27582754
import asyncio
27592755
27602756
async def native_coro():
@@ -2765,7 +2761,8 @@ def old_style_coro():
27652761
yield from native_coro()
27662762
27672763
asyncio.run(old_style_coro())
2768-
""")
2764+
"""
2765+
)
27692766
assert_python_ok("-c", code, PYTHONASYNCIODEBUG="1")
27702767

27712768

0 commit comments

Comments
 (0)