Skip to content

Commit

Permalink
v6.0.6
Browse files Browse the repository at this point in the history
- Adjusted loggers
- Adjusted tests
  • Loading branch information
sakan811 committed Aug 1, 2024
1 parent c061458 commit a8b3da5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 2 additions & 8 deletions tests/test_migrate_to_sqlite/test_migrate_data_to_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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)

Expand All @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions tests/test_utils/test_find_missing_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit a8b3da5

Please sign in to comment.