aminghadersohi commented on code in PR #44270:
URL: https://github.com/apache/superset/pull/44270#discussion_r4045215486


##########
tests/unit_tests/mcp_service/semantic_layer/tool/test_get_table.py:
##########
@@ -106,6 +113,154 @@ def _make_view(view_id: int = 5) -> MagicMock:
     return view
 
 
[email protected]
+def temporal_view() -> Generator[MagicMock, None, None]:
+    """Resolve a view with a temporal dimension and three queryable grains."""
+    view: MagicMock = _make_view()
+    view.columns = [
+        _make_column("metric_time", True),
+        _make_column("country_name"),
+    ]
+    view.get_time_grains.return_value = [
+        {"duration": "P1D", "name": "Day"},
+        {"duration": "P1W", "name": "Week"},
+        {"duration": "P1M", "name": "Month"},
+    ]
+    view.implementation.get_dimensions.return_value = [
+        Dimension(
+            id=f"metric_time__{grain.name}",
+            name="metric_time",
+            type=pa.timestamp("us"),
+            grain=grain,
+        )
+        for grain in (Grains.DAY, Grains.WEEK, Grains.MONTH)
+    ]

Review Comment:
   No fixture carries a `grain=None` dimension, but production 
`get_dimensions()` always returns them — the unaggregated variant plus every 
non-temporal dim. Deleting the `grain is not None` guard in `_grains_by_column` 
leaves all 70 green; with this fixture it fails 13.
   
   ```suggestion
           for grain in (Grains.DAY, Grains.WEEK, Grains.MONTH)
       ] + [
           # Production ``get_dimensions()`` also returns the unaggregated 
variant
           # and every non-temporal dimension, both with ``grain=None``.
           Dimension(id="metric_time", name="metric_time", 
type=pa.timestamp("us")),
           Dimension(id="country_name", name="country_name", type=pa.string()),
       ]
   ```



-- 
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