Add test cases for `RUF006` with lambdas (#13628)

As discussed in https://github.com/astral-sh/ruff/issues/13619
This commit is contained in:
Zanie Blue 2024-10-04 14:09:43 -05:00 committed by GitHub
parent 888930b7d3
commit 020f4d4a54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -185,3 +185,9 @@ def f():
global task global task
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
task = loop.create_task(main()) # Error task = loop.create_task(main()) # Error
# OK
# The task is returned by the lambda
f = lambda *args: asyncio.create_task(foo())
f = lambda *args: lambda *args: asyncio.create_task(foo())
f = lambda *args: [asyncio.create_task(foo()) for x in args]