You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "arkid15r (via GitHub)" <gi...@apache.org> on 2023/04/24 16:41:13 UTC

[GitHub] [superset] arkid15r commented on a diff in pull request #23685: fix(utils): evaluate date parser multiple holiday results correctly

arkid15r commented on code in PR #23685:
URL: https://github.com/apache/superset/pull/23685#discussion_r1175543370


##########
tests/unit_tests/utils/date_parser_tests.py:
##########
@@ -260,12 +264,30 @@ def test_datetime_eval() -> None:
     expected = datetime(2018, 9, 3, 0, 0, 0)
     assert result == expected
 
+    result = datetime_eval(
+        "holiday('Eid al-Fitr', datetime('2000-01-01T00:00:00'), 'SA')"
+    )
+    expected = datetime(2000, 1, 8, 0, 0, 0)
+    assert result == expected
+
     result = datetime_eval(
         "holiday('Boxing day', datetime('2018-01-01T00:00:00'), 'UK')"
     )
     expected = datetime(2018, 12, 26, 0, 0, 0)
     assert result == expected
 
+    result = datetime_eval(
+        "holiday('Juneteenth', datetime('2022-01-01T00:00:00'), 'US')"
+    )
+    expected = datetime(2022, 6, 19, 0, 0, 0)
+    assert result == expected
+
+    result = datetime_eval(
+        "holiday('Independence Day', datetime('2022-01-01T00:00:00'), 'US')"
+    )
+    expected = datetime(2022, 7, 4, 0, 0, 0)
+    assert result == expected
+

Review Comment:
   Hi @zhaoyongjie, 
   
   I read L273 as UK's (technically GB) test. And even if it was the US test I'd suggest to keep the L279-289 Juneteenth related tests as they specifically cover the wrong parser behaviour this PR trying to address.
   
   Thanks for reviewing this!



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org