mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
chore: upgrade black (#19410)
This commit is contained in:
@@ -93,7 +93,9 @@ class TestDbEngineSpecs(TestDbEngineSpec):
|
||||
|
||||
def test_limit_query_without_force(self):
|
||||
self.sql_limit_regex(
|
||||
"SELECT * FROM a LIMIT 10", "SELECT * FROM a LIMIT 10", limit=11,
|
||||
"SELECT * FROM a LIMIT 10",
|
||||
"SELECT * FROM a LIMIT 10",
|
||||
limit=11,
|
||||
)
|
||||
|
||||
def test_limit_query_with_force(self):
|
||||
@@ -399,7 +401,11 @@ def test_get_time_grain_with_unkown_values():
|
||||
config = app.config.copy()
|
||||
|
||||
app.config["TIME_GRAIN_ADDON_EXPRESSIONS"] = {
|
||||
"mysql": {"PT2H": "foo", "weird": "foo", "PT12H": "foo",}
|
||||
"mysql": {
|
||||
"PT2H": "foo",
|
||||
"weird": "foo",
|
||||
"PT12H": "foo",
|
||||
}
|
||||
}
|
||||
|
||||
with app.app_context():
|
||||
|
||||
@@ -139,8 +139,14 @@ class TestBigQueryDbEngineSpec(TestDbEngineSpec):
|
||||
self.assertEqual(result, {})
|
||||
|
||||
index_metadata = [
|
||||
{"name": "clustering", "column_names": ["c_col1", "c_col2", "c_col3"],},
|
||||
{"name": "partition", "column_names": ["p_col1", "p_col2", "p_col3"],},
|
||||
{
|
||||
"name": "clustering",
|
||||
"column_names": ["c_col1", "c_col2", "c_col3"],
|
||||
},
|
||||
{
|
||||
"name": "partition",
|
||||
"column_names": ["p_col1", "p_col2", "p_col3"],
|
||||
},
|
||||
]
|
||||
expected_result = {
|
||||
"partitions": {"cols": [["p_col1", "p_col2", "p_col3"]]},
|
||||
@@ -247,7 +253,12 @@ class TestBigQueryDbEngineSpec(TestDbEngineSpec):
|
||||
level=ErrorLevel.ERROR,
|
||||
extra={
|
||||
"engine_name": "Google BigQuery",
|
||||
"issue_codes": [{"code": 1017, "message": "",}],
|
||||
"issue_codes": [
|
||||
{
|
||||
"code": 1017,
|
||||
"message": "",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
]
|
||||
|
||||
@@ -166,7 +166,10 @@ def test_convert_dttm():
|
||||
def test_df_to_csv() -> None:
|
||||
with pytest.raises(SupersetException):
|
||||
HiveEngineSpec.df_to_sql(
|
||||
mock.MagicMock(), Table("foobar"), pd.DataFrame(), {"if_exists": "append"},
|
||||
mock.MagicMock(),
|
||||
Table("foobar"),
|
||||
pd.DataFrame(),
|
||||
{"if_exists": "append"},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec
|
||||
|
||||
|
||||
class TestPinotDbEngineSpec(TestDbEngineSpec):
|
||||
""" Tests pertaining to our Pinot database support """
|
||||
"""Tests pertaining to our Pinot database support"""
|
||||
|
||||
def test_pinot_time_expression_sec_one_1d_grain(self):
|
||||
col = column("tstamp")
|
||||
@@ -62,7 +62,8 @@ class TestPinotDbEngineSpec(TestDbEngineSpec):
|
||||
expr = PinotEngineSpec.get_timestamp_expr(col, "epoch_s", "P1M")
|
||||
result = str(expr.compile())
|
||||
self.assertEqual(
|
||||
result, "DATETRUNC('month', tstamp, 'SECONDS')",
|
||||
result,
|
||||
"DATETRUNC('month', tstamp, 'SECONDS')",
|
||||
)
|
||||
|
||||
def test_invalid_get_time_expression_arguments(self):
|
||||
|
||||
@@ -179,7 +179,11 @@ class TestPostgresDbEngineSpec(TestDbEngineSpec):
|
||||
sql = "SELECT * FROM birth_names"
|
||||
results = PostgresEngineSpec.estimate_statement_cost(sql, cursor)
|
||||
self.assertEqual(
|
||||
results, {"Start-up cost": 0.00, "Total cost": 1537.91,},
|
||||
results,
|
||||
{
|
||||
"Start-up cost": 0.00,
|
||||
"Total cost": 1537.91,
|
||||
},
|
||||
)
|
||||
|
||||
def test_estimate_statement_invalid_syntax(self):
|
||||
@@ -205,15 +209,27 @@ class TestPostgresDbEngineSpec(TestDbEngineSpec):
|
||||
DB Eng Specs (postgres): Test test_query_cost_formatter example costs
|
||||
"""
|
||||
raw_cost = [
|
||||
{"Start-up cost": 0.00, "Total cost": 1537.91,},
|
||||
{"Start-up cost": 10.00, "Total cost": 1537.00,},
|
||||
{
|
||||
"Start-up cost": 0.00,
|
||||
"Total cost": 1537.91,
|
||||
},
|
||||
{
|
||||
"Start-up cost": 10.00,
|
||||
"Total cost": 1537.00,
|
||||
},
|
||||
]
|
||||
result = PostgresEngineSpec.query_cost_formatter(raw_cost)
|
||||
self.assertEqual(
|
||||
result,
|
||||
[
|
||||
{"Start-up cost": "0.0", "Total cost": "1537.91",},
|
||||
{"Start-up cost": "10.0", "Total cost": "1537.0",},
|
||||
{
|
||||
"Start-up cost": "0.0",
|
||||
"Total cost": "1537.91",
|
||||
},
|
||||
{
|
||||
"Start-up cost": "10.0",
|
||||
"Total cost": "1537.0",
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -293,7 +293,10 @@ class TestPrestoDbEngineSpec(TestDbEngineSpec):
|
||||
)
|
||||
def test_presto_expand_data_with_complex_row_columns_and_null_values(self):
|
||||
cols = [
|
||||
{"name": "row_column", "type": "ROW(NESTED_ROW ROW(NESTED_OBJ VARCHAR))",}
|
||||
{
|
||||
"name": "row_column",
|
||||
"type": "ROW(NESTED_ROW ROW(NESTED_OBJ VARCHAR))",
|
||||
}
|
||||
]
|
||||
data = [
|
||||
{"row_column": '[["a"]]'},
|
||||
@@ -305,7 +308,10 @@ class TestPrestoDbEngineSpec(TestDbEngineSpec):
|
||||
cols, data
|
||||
)
|
||||
expected_cols = [
|
||||
{"name": "row_column", "type": "ROW(NESTED_ROW ROW(NESTED_OBJ VARCHAR))",},
|
||||
{
|
||||
"name": "row_column",
|
||||
"type": "ROW(NESTED_ROW ROW(NESTED_OBJ VARCHAR))",
|
||||
},
|
||||
{"name": "row_column.nested_row", "type": "ROW(NESTED_OBJ VARCHAR)"},
|
||||
{"name": "row_column.nested_row.nested_obj", "type": "VARCHAR"},
|
||||
]
|
||||
@@ -786,7 +792,10 @@ class TestPrestoDbEngineSpec(TestDbEngineSpec):
|
||||
True,
|
||||
True,
|
||||
True,
|
||||
[{"name": "val1"}, {"name": "val2<?!@#$312,/'][p098"},],
|
||||
[
|
||||
{"name": "val1"},
|
||||
{"name": "val2<?!@#$312,/'][p098"},
|
||||
],
|
||||
)
|
||||
|
||||
def test_estimate_statement_cost(self):
|
||||
|
||||
Reference in New Issue
Block a user