bito-code-review[bot] commented on code in PR #42288:
URL: https://github.com/apache/superset/pull/42288#discussion_r3626084530
##########
tests/unit_tests/mcp_service/chart/test_chart_utils.py:
##########
@@ -1576,6 +1580,85 @@ def test_falls_back_to_is_dttm_when_no_type(self,
mock_dao) -> None:
result = is_column_truly_temporal("year", 123)
assert result is True
+ @patch("superset.daos.dataset.DatasetDAO")
+ def test_returns_true_for_varchar_ds_column_with_is_dttm_and_date_format(
+ self, mock_dao
+ ) -> None:
+ """VARCHAR 'ds' column explicitly marked is_dttm with a date format
+ (e.g. Hive/Presto string partition column) should be treated as
+ temporal, mirroring TableColumn.is_temporal in Superset core."""
+ mock_dataset = self._create_mock_dataset(
+ "ds",
+ "VARCHAR",
+ GenericDataType.STRING,
+ is_dttm=True,
+ python_date_format="%Y-%m-%d",
+ )
+ mock_dao.find_by_id.return_value = mock_dataset
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Wrong mock method in test</b></div>
<div id="fix">
The test mocks `mock_dao.find_by_id` but `is_column_truly_temporal` resolves
its dataset via `DatasetDAO.find_by_id_or_uuid` (called by
`_find_dataset_by_id_or_uuid`). The mocked return value is never used, so the
test exercises the real DAO path instead. All other tests in this class
correctly mock `find_by_id_or_uuid`.
</div>
</div>
<small><i>Code Review Run #60212c</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]