-
-
Notifications
You must be signed in to change notification settings - Fork 22
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 #168 from niccokunzmann/timedelta
Timedelta
- Loading branch information
Showing
4 changed files
with
49 additions
and
7 deletions.
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
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,27 @@ | ||
"""This tests that a timedelta can be used as the second argument to between. | ||
This is useful when you do not want to calculate this yourself. | ||
""" | ||
|
||
from datetime import timedelta | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("start", "delta", "count"), | ||
[ | ||
("20190301", timedelta(days=3), 0), | ||
("20190301", timedelta(days=5), 1), | ||
("20190301", timedelta(days=3, hours=8), 0), | ||
("20190301", timedelta(days=3, hours=9), 1), | ||
("20190301", timedelta(days=3, hours=8, seconds=1), 1), | ||
("20190304", timedelta(days=1), 1), | ||
("20190304", timedelta(hours=8), 0), | ||
("20190304", timedelta(hours=9), 1), | ||
], | ||
) | ||
def test_event_with_between_and_timedelta(calendars, start, delta, count): | ||
"""The event starts at 20190304T080000 and ends at 20190304T080000""" | ||
events = calendars.one_event.between(start, delta) | ||
assert len(events) == count |