Skip to content

Commit bba1caa

Browse files
committed
test: use ISO T-separated expected values to catch silent string mismatch
Per review feedback, changing the expected strings to '0001-01-01T00:00:00' and '9999-12-31T23:59:59' means that if the datetime parsing regressed and fell back to a str-based comparison, the mismatch against str(datetime.datetime(1, 1, 1)) == '0001-01-01 00:00:00' would surface directly through assert_equal - not only via the log_warning check. The T-separated form still parses via pd.to_datetime -> us fallback to the same year-1 / year-9999 instances as before, so the test remains a valid end-to-end assertion of the fix in sqlmesh/core/test/definition.py. Signed-off-by: mokashang <shangmengjiajiajia@gmail.com>
1 parent d9c3820 commit bba1caa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tests/core/test_test.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2964,7 +2964,9 @@ def test_out_of_bounds_nanosecond_timestamp_comparison(mocker: MockerFixture) ->
29642964
)
29652965
}
29662966
)
2967-
expected = pd.DataFrame({"ts_col": ["0001-01-01 00:00:00", "9999-12-31 23:59:59"]})
2967+
# Use T separator so a string-only comparison (broken path) would mismatch
2968+
# against str(datetime.datetime(1, 1, 1)) == "0001-01-01 00:00:00".
2969+
expected = pd.DataFrame({"ts_col": ["0001-01-01T00:00:00", "9999-12-31T23:59:59"]})
29682970
log_warning = mocker.spy(get_console(), "log_warning")
29692971
test.assert_equal(expected=expected, actual=actual, sort=False)
29702972
for call_args in log_warning.call_args_list:

0 commit comments

Comments
 (0)