This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch fix_granularity_sqla
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/fix_granularity_sqla by this 
push:
     new 27dc908786 Move original_form_data to variable
27dc908786 is described below

commit 27dc9087861d8b4874153630d3f601e229cc032f
Author: Beto Dealmeida <[email protected]>
AuthorDate: Wed Sep 6 13:16:36 2023 -0700

    Move original_form_data to variable
---
 tests/unit_tests/legacy_tests.py | 102 +++++++++++++--------------------------
 1 file changed, 34 insertions(+), 68 deletions(-)

diff --git a/tests/unit_tests/legacy_tests.py b/tests/unit_tests/legacy_tests.py
index 43b6faa755..9a8f7fbcd2 100644
--- a/tests/unit_tests/legacy_tests.py
+++ b/tests/unit_tests/legacy_tests.py
@@ -22,6 +22,40 @@ from typing import Any
 from superset.legacy import update_time_range
 from tests.unit_tests.conftest import with_feature_flags
 
+original_form_data = {
+    "granularity_sqla": "order_date",
+    "datasource": "22__table",
+    "viz_type": "table",
+    "query_mode": "raw",
+    "groupby": [],
+    "time_grain_sqla": "P1D",
+    "temporal_columns_lookup": {"order_date": True},
+    "all_columns": ["order_date", "state", "product_code"],
+    "percent_metrics": [],
+    "adhoc_filters": [
+        {
+            "clause": "WHERE",
+            "subject": "order_date",
+            "operator": "TEMPORAL_RANGE",
+            "comparator": "No filter",
+            "expressionType": "SIMPLE",
+        }
+    ],
+    "order_by_cols": [],
+    "row_limit": 1000,
+    "server_page_length": 10,
+    "order_desc": True,
+    "table_timestamp_format": "smart_date",
+    "show_cell_bars": True,
+    "color_pn": True,
+    "extra_form_data": {},
+    "dashboards": [19],
+    "force": False,
+    "result_format": "json",
+    "result_type": "full",
+    "include_time": False,
+}
+
 
 def test_update_time_range_since_until() -> None:
     """
@@ -51,40 +85,6 @@ def 
test_update_time_range_granularity_sqla_no_feature_flag() -> None:
     """
     Tests for the unfiltered `granularity_sqla` when `GENERIC_CHART_AXES` is 
off.
     """
-    original_form_data = {
-        "granularity_sqla": "order_date",
-        "datasource": "22__table",
-        "viz_type": "table",
-        "query_mode": "raw",
-        "groupby": [],
-        "time_grain_sqla": "P1D",
-        "temporal_columns_lookup": {"order_date": True},
-        "all_columns": ["order_date", "state", "product_code"],
-        "percent_metrics": [],
-        "adhoc_filters": [
-            {
-                "clause": "WHERE",
-                "subject": "order_date",
-                "operator": "TEMPORAL_RANGE",
-                "comparator": "No filter",
-                "expressionType": "SIMPLE",
-            }
-        ],
-        "order_by_cols": [],
-        "row_limit": 1000,
-        "server_page_length": 10,
-        "order_desc": True,
-        "table_timestamp_format": "smart_date",
-        "show_cell_bars": True,
-        "color_pn": True,
-        "extra_form_data": {},
-        "dashboards": [19],
-        "force": False,
-        "result_format": "json",
-        "result_type": "full",
-        "include_time": False,
-    }
-
     form_data = copy.deepcopy(original_form_data)
     update_time_range(form_data)
     assert form_data == original_form_data
@@ -95,40 +95,6 @@ def 
test_update_time_range_granularity_sqla_with_feature_flag() -> None:
     """
     Tests for the unfiltered `granularity_sqla` when `GENERIC_CHART_AXES` is 
on.
     """
-    original_form_data = {
-        "granularity_sqla": "order_date",
-        "datasource": "22__table",
-        "viz_type": "table",
-        "query_mode": "raw",
-        "groupby": [],
-        "time_grain_sqla": "P1D",
-        "temporal_columns_lookup": {"order_date": True},
-        "all_columns": ["order_date", "state", "product_code"],
-        "percent_metrics": [],
-        "adhoc_filters": [
-            {
-                "clause": "WHERE",
-                "subject": "order_date",
-                "operator": "TEMPORAL_RANGE",
-                "comparator": "No filter",
-                "expressionType": "SIMPLE",
-            }
-        ],
-        "order_by_cols": [],
-        "row_limit": 1000,
-        "server_page_length": 10,
-        "order_desc": True,
-        "table_timestamp_format": "smart_date",
-        "show_cell_bars": True,
-        "color_pn": True,
-        "extra_form_data": {},
-        "dashboards": [19],
-        "force": False,
-        "result_format": "json",
-        "result_type": "full",
-        "include_time": False,
-    }
-
     form_data = copy.deepcopy(original_form_data)
     update_time_range(form_data)
     assert form_data["time_range"] == "No filter"

Reply via email to