sadpandajoe commented on code in PR #42054:
URL: https://github.com/apache/superset/pull/42054#discussion_r3590947182


##########
tests/unit_tests/utils/date_parser_tests.py:
##########
@@ -561,6 +563,18 @@ def test_get_past_or_future() -> None:
     assert get_past_or_future("3 month", dttm) == datetime(2020, 5, 29)
 
 
+def test_normalize_time_delta() -> None:
+    assert normalize_time_delta("1 year ago") == {"years": -1}
+    assert normalize_time_delta("2 months later") == {"months": 2}
+    assert normalize_time_delta("28 days ago") == {"days": -28}
+    # quarters are converted to months (pd.DateOffset has no quarters argument)
+    assert normalize_time_delta("1 quarter ago") == {"months": -3}
+    assert normalize_time_delta("2 quarters later") == {"months": 6}

Review Comment:
   Added coverage for the remaining units (seconds, minutes, hours, weeks) in 
6955917680.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



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

Reply via email to