Skip to content

Commit

Permalink
Create test_pipeline.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BayoAdejare authored Nov 3, 2024
1 parent f5c07a6 commit 1f94005
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_pipeline.py
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

0 comments on commit 1f94005

Please sign in to comment.