chore: enforce more ruff rules (#31447)

Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
Maxime Beauchemin
2024-12-18 17:41:34 -08:00
committed by GitHub
parent 9da65d6bfd
commit e51b95ffa8
375 changed files with 1821 additions and 1718 deletions

View File

@@ -92,7 +92,7 @@ class TestSavedQueryApi(SupersetTestCase):
description="cool description",
)
@pytest.fixture()
@pytest.fixture
def create_saved_queries(self):
with self.create_app().app_context():
saved_queries = []
@@ -480,9 +480,9 @@ class TestSavedQueryApi(SupersetTestCase):
assert data_by_id["count"] == data_by_name["count"], len(
expected_saved_queries
)
assert set(query["id"] for query in data_by_id["result"]) == set(
assert set(query["id"] for query in data_by_id["result"]) == set( # noqa: C401
query["id"] for query in data_by_name["result"]
), set(query.id for query in expected_saved_queries)
), set(query.id for query in expected_saved_queries) # noqa: C401
@pytest.mark.usefixtures("create_saved_queries")
def test_get_saved_query_favorite_filter(self):

View File

@@ -47,7 +47,7 @@ class TestExportSavedQueriesCommand(SupersetTestCase):
sql="SELECT 42",
label="The answer",
schema="schema1",
description="Answer to the Ultimate Question of Life, the Universe, and Everything",
description="Answer to the Ultimate Question of Life, the Universe, and Everything", # noqa: E501
)
db.session.add(self.example_query)
db.session.commit()
@@ -78,7 +78,7 @@ class TestExportSavedQueriesCommand(SupersetTestCase):
"catalog": None,
"schema": "schema1",
"label": "The answer",
"description": "Answer to the Ultimate Question of Life, the Universe, and Everything",
"description": "Answer to the Ultimate Question of Life, the Universe, and Everything", # noqa: E501
"sql": "SELECT 42",
"uuid": str(self.example_query.uuid),
"version": "1.0.0",
@@ -110,7 +110,7 @@ class TestExportSavedQueriesCommand(SupersetTestCase):
command = ExportSavedQueriesCommand([self.example_query.id])
contents = command.run()
with self.assertRaises(SavedQueryNotFoundError):
with self.assertRaises(SavedQueryNotFoundError): # noqa: PT027
next(contents)
@patch("superset.queries.saved_queries.filters.g")
@@ -120,7 +120,7 @@ class TestExportSavedQueriesCommand(SupersetTestCase):
command = ExportSavedQueriesCommand([-1])
contents = command.run()
with self.assertRaises(SavedQueryNotFoundError):
with self.assertRaises(SavedQueryNotFoundError): # noqa: PT027
next(contents)
@patch("superset.queries.saved_queries.filters.g")