Skip to content

Commit

Permalink
make sure tests are on two year
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennecallies committed Oct 3, 2024
1 parent 7e48ca3 commit b235e49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions home/utils/date_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def ts_us_to_datetime(timestamp_us):
return make_aware(datetime.fromtimestamp(timestamp_us / 1000000.0))


def get_year_start_and_end(year: int):
return datetime(year, 1, 1), datetime(year, 12, 31, 23, 59, 59)
def get_year_start(year: int):
return datetime(year, 1, 1)


def get_year_end(year: int):
return datetime(year, 12, 31, 23, 59, 59)


def get_current_year() -> int:
Expand Down
8 changes: 5 additions & 3 deletions scraping/tests/tests_llm_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import simple_cache
from dotenv import load_dotenv

from home.utils.date_utils import get_year_start_and_end
from home.utils.date_utils import get_year_start, get_year_end
from scraping.parse.llm_client import OpenAILLMClient, get_openai_client
from scraping.parse.parse_with_llm import parse_with_llm, get_llm_model, get_prompt_template
from scraping.parse.schedules import SchedulesList, get_merged_schedules_list
Expand Down Expand Up @@ -77,7 +77,8 @@ def test_llm_parsing(self):
self.assertIsNotNone(schedules_list)
# print(schedules_list.model_dump_json())

year_start, year_end = get_year_start_and_end(year)
year_start = get_year_start(year)
year_end = get_year_end(year + 1)
are_equivalent, reason = are_schedules_list_equivalent(
schedules_list, expected_schedules_list, year_start, year_end)

Expand Down Expand Up @@ -126,7 +127,8 @@ def test_llm_parsing_with_cancellation(self):
self.assertIsNotNone(schedules_list2)
# print(schedules_list2.model_dump_json())

year_start, year_end = get_year_start_and_end(year)
year_start = get_year_start(year)
year_end = get_year_end(year + 1)

merged_schedules_list = get_merged_schedules_list([
schedules_list1,
Expand Down

0 comments on commit b235e49

Please sign in to comment.