mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: enforce more ruff rules (#31447)
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9da65d6bfd
commit
e51b95ffa8
@@ -113,7 +113,7 @@ class TestExportChartsCommand(SupersetTestCase):
|
||||
example_chart = db.session.query(Slice).all()[0]
|
||||
command = ExportChartsCommand([example_chart.id])
|
||||
contents = command.run()
|
||||
with self.assertRaises(ChartNotFoundError):
|
||||
with self.assertRaises(ChartNotFoundError): # noqa: PT027
|
||||
next(contents)
|
||||
|
||||
@patch("superset.security.manager.g")
|
||||
@@ -122,7 +122,7 @@ class TestExportChartsCommand(SupersetTestCase):
|
||||
mock_g.user = security_manager.find_user("admin")
|
||||
command = ExportChartsCommand([-1])
|
||||
contents = command.run()
|
||||
with self.assertRaises(ChartNotFoundError):
|
||||
with self.assertRaises(ChartNotFoundError): # noqa: PT027
|
||||
next(contents)
|
||||
|
||||
@patch("superset.security.manager.g")
|
||||
@@ -200,7 +200,7 @@ class TestImportChartsCommand(SupersetTestCase):
|
||||
"color_picker": {"a": 1, "b": 135, "g": 122, "r": 0},
|
||||
"datasource": dataset.uid if dataset else None,
|
||||
"js_columns": ["color"],
|
||||
"js_data_mutator": "data => data.map(d => ({\\n ...d,\\n color: colors.hexToRGB(d.extraProps.color)\\n}));",
|
||||
"js_data_mutator": "data => data.map(d => ({\\n ...d,\\n color: colors.hexToRGB(d.extraProps.color)\\n}));", # noqa: E501
|
||||
"js_onclick_href": "",
|
||||
"js_tooltip": "",
|
||||
"line_column": "path_json",
|
||||
@@ -417,7 +417,7 @@ class TestChartsUpdateCommand(SupersetTestCase):
|
||||
|
||||
class TestChartWarmUpCacheCommand(SupersetTestCase):
|
||||
def test_warm_up_cache_command_chart_not_found(self):
|
||||
with self.assertRaises(WarmUpCacheChartNotFoundError):
|
||||
with self.assertRaises(WarmUpCacheChartNotFoundError): # noqa: PT027
|
||||
ChartWarmUpCacheCommand(99999, None, None).run()
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
@@ -469,16 +469,16 @@ class TestFavoriteChartCommand(SupersetTestCase):
|
||||
example_chart_id = 1234
|
||||
|
||||
with override_user(security_manager.find_user("admin")):
|
||||
with self.assertRaises(ChartNotFoundError):
|
||||
with self.assertRaises(ChartNotFoundError): # noqa: PT027
|
||||
AddFavoriteChartCommand(example_chart_id).run()
|
||||
|
||||
with self.assertRaises(ChartNotFoundError):
|
||||
with self.assertRaises(ChartNotFoundError): # noqa: PT027
|
||||
DelFavoriteChartCommand(example_chart_id).run()
|
||||
|
||||
@pytest.mark.usefixtures("load_energy_table_with_slice")
|
||||
@patch("superset.daos.base.BaseDAO.find_by_id")
|
||||
def test_fave_unfave_chart_command_forbidden(self, mock_find_by_id):
|
||||
"""Test that faving / unfaving raises an exception for a chart the user doesn't own"""
|
||||
"""Test that faving / unfaving raises an exception for a chart the user doesn't own""" # noqa: E501
|
||||
with self.client.application.test_request_context():
|
||||
example_chart = db.session.query(Slice).all()[0]
|
||||
mock_find_by_id.return_value = example_chart
|
||||
@@ -487,8 +487,8 @@ class TestFavoriteChartCommand(SupersetTestCase):
|
||||
assert example_chart is not None
|
||||
|
||||
with override_user(security_manager.find_user("gamma")):
|
||||
with self.assertRaises(ChartForbiddenError):
|
||||
with self.assertRaises(ChartForbiddenError): # noqa: PT027
|
||||
AddFavoriteChartCommand(example_chart.id).run()
|
||||
|
||||
with self.assertRaises(ChartForbiddenError):
|
||||
with self.assertRaises(ChartForbiddenError): # noqa: PT027
|
||||
DelFavoriteChartCommand(example_chart.id).run()
|
||||
|
||||
Reference in New Issue
Block a user