mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(date_parser): add check for time range timeshifts (#36039)
This commit is contained in:
committed by
GitHub
parent
c42e3c6837
commit
c9f65cf1c2
@@ -271,6 +271,15 @@ def test_get_since_until() -> None:
|
||||
expected = datetime(1999, 12, 25), datetime(2017, 12, 25)
|
||||
assert result == expected
|
||||
|
||||
# Test time_shift with date range format (contains ' : ')
|
||||
result = get_since_until(
|
||||
time_range="today : tomorrow",
|
||||
time_shift="yesterday : today",
|
||||
)
|
||||
# When time_shift contains ' : ', it should be parsed as a new time range
|
||||
expected = datetime(2016, 11, 6), datetime(2016, 11, 7)
|
||||
assert result == expected
|
||||
|
||||
with pytest.raises(ValueError): # noqa: PT011
|
||||
get_since_until(time_range="tomorrow : yesterday")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user