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

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

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


##########
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 there, the US holiday case was added to L273 so the duplicated test case is not necessary. Thanks for supporting more widely holiday types!



-- 
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