diff --git a/tests/test_migrate_to_sqlite/test_migrate_data_to_sqlite.py b/tests/test_migrate_to_sqlite/test_migrate_data_to_sqlite.py index e0dafff..fd3314e 100644 --- a/tests/test_migrate_to_sqlite/test_migrate_data_to_sqlite.py +++ b/tests/test_migrate_to_sqlite/test_migrate_data_to_sqlite.py @@ -5,7 +5,7 @@ from japan_avg_hotel_price_finder.migrate_to_sqlite import migrate_data_to_sqlite -def test_successful_connection_to_sqlite(mocker): +def test_successful_connection_to_sqlite(): # Given df_filtered = pd.DataFrame({ 'Hotel': ['Hotel A', 'Hotel B'], @@ -18,9 +18,6 @@ def test_successful_connection_to_sqlite(mocker): }) db = 'test_successful_connection_to_sqlite.db' - # Mock the logger to avoid actual logging - mocker.patch('japan_avg_hotel_price_finder.migrate_to_sqlite.logger') - # When migrate_data_to_sqlite(df_filtered, db) @@ -32,14 +29,11 @@ def test_successful_connection_to_sqlite(mocker): assert len(result) > 0 -def test_handle_empty_dataframe(mocker): +def test_handle_empty_dataframe(): # Given df_filtered = pd.DataFrame(columns=['Hotel', 'Price', 'Review', 'Price/Review', 'City', 'Date', 'AsOf']) db = 'test_handle_empty_dataframe.db' - # Mock the logger to avoid actual logging - mocker.patch('japan_avg_hotel_price_finder.migrate_to_sqlite.logger') - # When migrate_data_to_sqlite(df_filtered, db) diff --git a/tests/test_utils/test_find_missing_dates.py b/tests/test_utils/test_find_missing_dates.py index 47c2263..e975a6d 100644 --- a/tests/test_utils/test_find_missing_dates.py +++ b/tests/test_utils/test_find_missing_dates.py @@ -32,17 +32,19 @@ def test_find_missing_dates(): def test_find_missing_dates_of_different_months(): result = [] expected_result = [] + today = datetime.datetime.today() month = today.month year = today.year + for i in range(1, 3): - month = month + i + month += i if month > 12: month = 1 year += 1 - days_in_month = monthrange(year, i)[1] + days_in_month = monthrange(year, month)[1] date1 = datetime.date(year, month, 1).strftime('%Y-%m-%d') date2 = datetime.date(year, month, 5).strftime('%Y-%m-%d')