Skip to content

Commit 5f0dc78

Browse files
committed
fix tests
1 parent fbd1709 commit 5f0dc78

File tree

2 files changed

+45
-55
lines changed

2 files changed

+45
-55
lines changed

tests/time_window_filter/recurrence_util.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

tests/time_window_filter/test_recurrence_validator.py

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,54 @@
55
# -------------------------------------------------------------------------
66
from datetime import timedelta, datetime
77
import pytest
8-
from .recurrence_util import (
9-
valid_daily_recurrence,
10-
valid_daily_end_date_recurrence,
11-
valid_no_end_range,
12-
START,
13-
END,
14-
)
158
from featuremanagement._time_window_filter._models import Recurrence
169
from featuremanagement._time_window_filter._recurrence_validator import validate_settings
1710

11+
DATE_FORMAT = "%a, %d %b %Y %H:%M:%S"
12+
13+
START_STRING = "Mon, 31 Mar 2025 00:00:00"
14+
START = datetime.strptime(START_STRING, DATE_FORMAT)
15+
END_STRING = "Mon, 31 Mar 2025 23:59:59"
16+
END = datetime.strptime(END_STRING, DATE_FORMAT)
17+
18+
19+
def valid_daily_pattern():
20+
return {
21+
"Type": "Daily",
22+
"Interval": 1,
23+
"DaysOfWeek": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
24+
"FirstDayOfWeek": "Sunday",
25+
}
26+
27+
28+
def valid_no_end_range():
29+
return {
30+
"Type": "NoEnd",
31+
"EndDate": None,
32+
"NumberOfOccurrences": 10,
33+
}
34+
35+
36+
def valid_daily_recurrence():
37+
return Recurrence(
38+
{
39+
"Pattern": valid_daily_pattern(),
40+
"Range": valid_no_end_range(),
41+
}
42+
)
43+
44+
45+
def valid_daily_end_date_recurrence():
46+
return Recurrence(
47+
{
48+
"Pattern": valid_daily_pattern(),
49+
"Range": {
50+
"Type": "EndDate",
51+
"EndDate": (START + timedelta(days=10)).strftime(DATE_FORMAT),
52+
"NumberOfOccurrences": 10,
53+
},
54+
}
55+
)
1856

1957
def test_validate_settings_valid_daily():
2058
validate_settings(valid_daily_recurrence(), START, END)

0 commit comments

Comments
 (0)