-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
f5c07a6
commit 1f94005
Showing
1 changed file
with
22 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# tests/test_pipeline.py | ||
import pytest | ||
from datetime import datetime | ||
from your_module import validate_dates, prepare_hours | ||
|
||
def test_validate_dates_valid(): | ||
start, end = validate_dates("01/01/2024", "02/01/2024") | ||
assert isinstance(start, datetime) | ||
assert isinstance(end, datetime) | ||
assert end > start | ||
|
||
def test_validate_dates_invalid(): | ||
with pytest.raises(ValueError): | ||
validate_dates("02/01/2024", "01/01/2024") # end before start | ||
|
||
def test_prepare_hours_valid(): | ||
hours = prepare_hours(["00", "01", "23"]) | ||
assert all(h in hours for h in ["00", "01", "23"]) | ||
|
||
def test_prepare_hours_invalid(): | ||
with pytest.raises(ValueError): | ||
prepare_hours(["24"]) # invalid hour |