This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6043a70
commit 5a28022
Showing
2 changed files
with
22 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
from times import compute_overlap_time, time_range | ||
import pytest | ||
|
||
def test_given_input(): | ||
|
||
# Assert 1 - test should pass | ||
range1 = time_range("2010-01-12 10:00:00", "2010-01-12 12:00:00") | ||
range2 = time_range("2010-01-12 10:30:00", "2010-01-12 10:45:00", 2, 60) | ||
result = compute_overlap_time(range1, range2) | ||
expected = [('2010-01-12 10:30:00', '2010-01-12 10:37:00'), ('2010-01-12 10:38:00', '2010-01-12 10:45:00')] | ||
assert result == expected | ||
|
||
# Assert 2 - test should work | ||
range5 = time_range("2001-01-12 10:00:00", "2010-01-12 12:00:00") | ||
range6 = time_range("2001-01-12 10:30:00", "2010-01-12 10:45:00", 2, 60) | ||
result = compute_overlap_time(range5, range6) | ||
expected = [('2001-01-12 10:30:00', '2005-07-13 22:37:00'), ('2005-07-13 22:38:00', '2010-01-12 10:45:00')] | ||
assert result == expected | ||
|
||
# Assert 2 - test should fail (value error in range time / instead of -) | ||
range3 = time_range("2010-01-12 10:00:00", "2010-01/12 12:00:00") | ||
range4 = time_range("2010-01-12 10:30:00", "2010-01-12 10:45:00", 2, 60) | ||
result = compute_overlap_time(range3, range4) | ||
expected = [('2010-01-12 10:30:00', '2010-01-12 10:37:00'), ('2010-01-12 10:38:00', '2010-01-12 10:45:00')] | ||
assert result == expected | ||
|
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