ruff: enable TC — flake8-type-checking (#11368)

## Problem

`TYPE_CHECKING` is used inconsistently across Python tests.

## Summary of changes
- Update `ruff`: 0.7.0 -> 0.11.2
- Enable TC (flake8-type-checking):
https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
- (auto)fix all new issues
This commit is contained in:
Alexander Bayandin
2025-03-30 20:58:33 +02:00
committed by GitHub
parent db5384e1b0
commit 30a7dd630c
169 changed files with 1263 additions and 888 deletions

View File

@@ -103,22 +103,22 @@ def test_compute_catalog(neon_simple_env: NeonEnv):
objects = client.dbs_and_roles()
# Assert that 'cloud_admin' role exists in the 'roles' list
assert any(
role["name"] == "cloud_admin" for role in objects["roles"]
), "The 'cloud_admin' role is missing"
assert any(role["name"] == "cloud_admin" for role in objects["roles"]), (
"The 'cloud_admin' role is missing"
)
# Assert that 'postgres' database exists in the 'databases' list
assert any(
db["name"] == "postgres" for db in objects["databases"]
), "The 'postgres' database is missing"
assert any(db["name"] == "postgres" for db in objects["databases"]), (
"The 'postgres' database is missing"
)
# Check other databases
for test_db in TEST_DB_NAMES:
db = next((db for db in objects["databases"] if db["name"] == test_db["name"]), None)
assert db is not None, f"The '{test_db['name']}' database is missing"
assert (
db["owner"] == test_db["owner"]
), f"The '{test_db['name']}' database has incorrect owner"
assert db["owner"] == test_db["owner"], (
f"The '{test_db['name']}' database has incorrect owner"
)
ddl = client.database_schema(database=test_db["name"])
@@ -135,9 +135,9 @@ def test_compute_catalog(neon_simple_env: NeonEnv):
client.database_schema(database="nonexistentdb")
raise AssertionError("Expected HTTPError was not raised")
except requests.exceptions.HTTPError as e:
assert (
e.response.status_code == 404
), f"Expected 404 status code, but got {e.response.status_code}"
assert e.response.status_code == 404, (
f"Expected 404 status code, but got {e.response.status_code}"
)
def test_compute_create_drop_dbs_and_roles(neon_simple_env: NeonEnv):