-
Notifications
You must be signed in to change notification settings - Fork 0
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
74c5982
commit 6c77ebc
Showing
2 changed files
with
85 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
33 changes: 33 additions & 0 deletions
33
tests/test_trivia/test_specific_trivia/test_max_consecutive_activities.py
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,33 @@ | ||
import datetime as dt | ||
|
||
from active_statistics.statistics.trivia import TriviaProcessor | ||
from active_statistics.statistics.trivia.summary_trivia import ( | ||
MostConsecutiveDaysOfActivities, | ||
) | ||
from tests.factories.activity_factories import ActivityFactory | ||
|
||
|
||
def test_general_trivia(some_basic_runs_and_rides) -> None: | ||
""" | ||
Tests that the most consecutive days calculator is correct. | ||
""" | ||
processor = TriviaProcessor() | ||
processor.register_tidbit(MostConsecutiveDaysOfActivities()) | ||
|
||
activities = [ | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 1, 2)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 2, 19)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 4, 3)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 5, 10)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 6, 1)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 7, 22)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 7, 23)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 10, 1)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 10, 2)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 10, 3)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 11, 4)), | ||
ActivityFactory(start_date_local=dt.datetime(2023, 1, 12, 5)), | ||
] | ||
|
||
result = processor.get_data(activity for activity in activities) | ||
assert result[0][1] == "4 days (2023-01-04 to 2023-01-07)" |