-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1694 from emfcamp/my-day-is-frabbed
frab output: events with a duration of >1d should render as D:HH:MM
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from datetime import datetime | ||
|
||
import pytest | ||
|
||
from apps.schedule import schedule_xml | ||
|
||
|
||
@pytest.mark.parametrize('start_time, end_time, expected', [ | ||
('2024-01-01 00:00:00', '2024-01-01 00:01:00', '0:01'), | ||
('2024-01-01 00:00:00', '2024-01-01 00:01:45', '0:01'), | ||
('2024-01-01 00:00:00', '2024-01-01 01:00:00', '1:00'), | ||
('2024-01-01 00:00:00', '2024-01-01 12:00:00', '12:00'), | ||
('2024-01-01 00:00:00', '2024-01-02 00:00:00', '1:00:00'), | ||
('2024-01-01 00:00:00', '2024-01-02 12:34:00', '1:12:34'), | ||
]) | ||
def test_get_duration(start_time, end_time, expected): | ||
fmt = '%Y-%m-%d %H:%M:%S' | ||
start_time = datetime.strptime(start_time, fmt) | ||
end_time = datetime.strptime(end_time, fmt) | ||
assert schedule_xml.get_duration(start_time, end_time) == expected |