mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00

## Summary We're seeing failures in https://github.com/astral-sh/ruff/issues/10470 because `resolve_qualified_import_name` isn't guaranteed to return a specific import if a symbol is accessible in two ways (e.g., you have both `import logging` and `from logging import error` in scope, and you want `logging.error`). This PR breaks up the failing tests such that the imports aren't in the same scope. Closes https://github.com/astral-sh/ruff/issues/10470. ## Test Plan I added a `bindings.reverse()` to `resolve_qualified_import_name` to ensure that the tests pass regardless of the binding order.
28 lines
348 B
Python
28 lines
348 B
Python
def func():
|
|
import datetime
|
|
|
|
print(datetime.timezone(-1))
|
|
|
|
|
|
def func():
|
|
from datetime import timezone
|
|
|
|
print(timezone.utc)
|
|
|
|
|
|
def func():
|
|
from datetime import timezone as tz
|
|
|
|
print(tz.utc)
|
|
|
|
|
|
def func():
|
|
import datetime
|
|
|
|
print(datetime.timezone.utc)
|
|
|
|
|
|
def func():
|
|
import datetime as dt
|
|
|
|
print(dt.timezone.utc)
|