forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[
ruff
] Issue astral-sh#9951, RUF029: ruff format the RUF029.py fixture
- Loading branch information
Showing
1 changed file
with
10 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
import time | ||
import asyncio | ||
|
||
async def pass_case(): # OK: awaits a coroutine | ||
|
||
async def pass_case(): # OK: awaits a coroutine | ||
print("hello") | ||
await asyncio.sleep(1) | ||
print("world") | ||
|
||
async def fail_case(): # RUF029 | ||
|
||
async def fail_case(): # RUF029 | ||
print("hello") | ||
time.sleep(1) | ||
print("world") | ||
|
||
|
||
async def pass_case_2(): # OK: uses an async context manager | ||
async def pass_case_2(): # OK: uses an async context manager | ||
async with None as i: | ||
pass | ||
|
||
async def fail_case_2(): # RUF029 | ||
|
||
async def fail_case_2(): # RUF029 | ||
with None as i: | ||
pass | ||
|
||
|
||
async def pass_case_3(): # OK: uses an async loop | ||
async def pass_case_3(): # OK: uses an async loop | ||
async for i in []: | ||
pass | ||
|
||
async def fail_case_3(): # RUF029 | ||
|
||
async def fail_case_3(): # RUF029 | ||
for i in []: | ||
pass |