Skip to content

Commit

Permalink
test equal operator
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrothe committed Dec 8, 2023
1 parent 293f6c8 commit 265bde4
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,47 +113,33 @@ def test_ref_day_within_range() -> None:
from_dates = pd.Series(["2023-01-01", "2023-02-10"])
to_dates = pd.Series(["2023-01-20", "2023-02-18"])
expected = pd.Series([True, True])
assert ref_day(from_dates, to_dates).equals(
expected
assert (
ref_day(from_dates, to_dates) == expected
), "16th day within range test failed"


def test_ref_day_outside_range() -> None:
from_dates = pd.Series(["2023-03-17", "2023-04-18"])
to_dates = pd.Series(["2023-03-30", "2023-04-25"])
expected = pd.Series([False, False])
assert ref_day(from_dates, to_dates).equals(
expected
assert (
ref_day(from_dates, to_dates) == expected
), "16th day outside range test failed"


def test_ref_week_within_range() -> None:
from_dates = pd.Series(
pd.to_datetime(
[
"2023-01-22",
"2023-04-01",
]
)
)
to_dates = pd.Series(
pd.to_datetime(
[
"2023-01-31",
"2023-04-15",
]
)
)
from_dates = pd.Series(pd.to_datetime(["2023-01-22", "2023-04-01"]))
to_dates = pd.Series(pd.to_datetime(["2023-01-31", "2023-04-15"]))
expected = pd.Series([True, True])
assert ref_week(from_dates, to_dates).equals(
expected
assert (
ref_week(from_dates, to_dates) == expected
), "Reference week within range test failed"


def test_ref_week_outside_range() -> None:
from_dates = pd.Series(pd.to_datetime(["2023-01-01", "2023-04-17"]))
to_dates = pd.Series(pd.to_datetime(["2023-01-15", "2023-04-30"]))
expected = pd.Series([False, False])
assert ref_week(from_dates, to_dates).equals(
expected
assert (
ref_week(from_dates, to_dates) == expected
), "Reference week outside range test failed"

0 comments on commit 265bde4

Please sign in to comment.