Copilot commented on code in PR #39782:
URL: https://github.com/apache/superset/pull/39782#discussion_r3236317925
##########
tests/unit_tests/models/core_test.py:
##########
@@ -199,15 +199,20 @@ class OldDBEngineSpec(BaseEngineSpec):
@pytest.mark.parametrize(
"dttm,col,database,result",
+ # Make sure that dttm and result share the same timezone awareness.
+ # Either dttm and result are both timezone-naive.
+ # Or dttm and result are both timezone-aware, e.g. dttm is a datetime
object with
+ # non-null tzinfo and result is a UNIX timestamp with epoch (sub-)seconds
since
+ # 1970-01-01 00:00:00 UTC.
[
(
- datetime(2023, 1, 1, 1, 23, 45, 600000),
+ datetime(2023, 1, 1, 1, 23, 45, 600000, timezone.utc),
Review Comment:
Passing `timezone.utc` as a positional argument relies on readers
remembering the exact `datetime(...)` parameter order (microsecond, tzinfo,
fold). Consider using the keyword form `tzinfo=timezone.utc` to avoid ambiguity
and make the intent clearer/safer against accidental mis-ordering in future
edits.
##########
tests/unit_tests/models/core_test.py:
##########
@@ -199,15 +199,20 @@ class OldDBEngineSpec(BaseEngineSpec):
@pytest.mark.parametrize(
"dttm,col,database,result",
+ # Make sure that dttm and result share the same timezone awareness.
+ # Either dttm and result are both timezone-naive.
+ # Or dttm and result are both timezone-aware, e.g. dttm is a datetime
object with
+ # non-null tzinfo and result is a UNIX timestamp with epoch (sub-)seconds
since
+ # 1970-01-01 00:00:00 UTC.
[
(
- datetime(2023, 1, 1, 1, 23, 45, 600000),
+ datetime(2023, 1, 1, 1, 23, 45, 600000, timezone.utc),
TableColumn(python_date_format="epoch_s"),
Database(),
"1672536225",
),
(
- datetime(2023, 1, 1, 1, 23, 45, 600000),
+ datetime(2023, 1, 1, 1, 23, 45, 600000, timezone.utc),
Review Comment:
Passing `timezone.utc` as a positional argument relies on readers
remembering the exact `datetime(...)` parameter order (microsecond, tzinfo,
fold). Consider using the keyword form `tzinfo=timezone.utc` to avoid ambiguity
and make the intent clearer/safer against accidental mis-ordering in future
edits.
--
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]