sadpandajoe commented on code in PR #38591:
URL: https://github.com/apache/superset/pull/38591#discussion_r2997877773


##########
tests/unit_tests/reports/model_test.py:
##########
@@ -240,3 +240,176 @@ def test_report_generate_native_filter_no_column_name():
             "ownState": {},
         }
     }
+
+
+def test_report_generate_native_filter_select_null_column():
+    report_schedule = ReportSchedule()
+    result = report_schedule._generate_native_filter(
+        "F1", "filter_select", None, ["US"]
+    )
+    assert result["F1"]["extraFormData"]["filters"][0]["col"] == ""
+    assert result["F1"]["filterState"]["label"] == ""
+
+
+def test_generate_native_filter_time_normal():
+    report_schedule = ReportSchedule()
+    result = report_schedule._generate_native_filter(
+        "F2", "filter_time", "ignored", ["Last week"]
+    )
+    assert result == {
+        "F2": {
+            "id": "F2",
+            "extraFormData": {"time_range": "Last week"},
+            "filterState": {"value": "Last week"},
+            "ownState": {},
+        }
+    }
+
+
+def test_generate_native_filter_time_empty_values():
+    # Regression: locks crash behavior until upstream fix (see PROJECT.md)
+    report_schedule = ReportSchedule()
+    with pytest.raises(IndexError):
+        report_schedule._generate_native_filter("F2", "filter_time", 
"ignored", [])

Review Comment:
   Already fixed — defensive guards were added to `models.py` in a later commit 
and master merged them. The test now asserts safe behavior (returns empty 
dict), not the crash. This comment references a stale snapshot.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to