bito-code-review[bot] commented on PR #42589:
URL: https://github.com/apache/superset/pull/42589#issuecomment-5124487236
<!-- Bito Reply -->
The flagged issue is correct. The current test uses a manually constructed
DataFrame with a fixed format, which does not exercise the logic that handles
inferred formats or native datetime objects often encountered in real chart
data paths. To resolve this, you should add a test case that uses a DataFrame
with native datetime objects (e.g., `pd.to_datetime`) and/or one where the
`DateColumn` metadata relies on inferred formatting, ensuring
`normalize_dttm_col` handles these inputs correctly without unexpected
transformations.
**tests/unit_tests/utils/test_core.py**
```
def test_normalize_dttm_col_with_native_datetime() -> None:
df = pd.DataFrame({"dttm": pd.to_datetime(["2026-02-15 16:30:00",
"2026-02-15 10:00:00"])})
dttm_cols = (DateColumn(col_label="dttm", timestamp_format=None,
offset=0),)
normalize_dttm_col(df, dttm_cols)
assert is_datetime64_dtype(df["dttm"])
assert df["dttm"].iloc[0] == pd.Timestamp("2026-02-15 16:30:00")
```
--
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]