Skip to content

Commit

Permalink
sorting asserting
Browse files Browse the repository at this point in the history
  • Loading branch information
benhammondmusic committed May 10, 2024
1 parent 0ff56dc commit 6e9406f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions python/tests/datasources/test_cdc_wisqars_youth.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def test_write_to_bq_youth_by_race_national(
geographic=NATIONAL_LEVEL,
)

assert mock_data_dir.call_count == 4

(mock_current, mock_historical) = mock_bq.call_args_list

actual_current_df, _, table_name = mock_current[0]
Expand All @@ -74,6 +76,13 @@ def test_write_to_bq_youth_by_race_national(

assert mock_bq.call_count == 2

actual_historical_df = actual_historical_df.sort_values(by=['time_period', 'race_and_ethnicity']).reset_index(
drop=True
)
expected_historical_df = expected_historical_df.sort_values(by=['time_period', 'race_and_ethnicity']).reset_index(
drop=True
)

assert_frame_equal(actual_current_df, expected_current_df, check_like=True)
assert_frame_equal(actual_historical_df, expected_historical_df, check_like=True)

Expand All @@ -95,6 +104,8 @@ def test_write_to_bq_youth_by_race_state(
geographic=STATE_LEVEL,
)

assert mock_data_dir.call_count == 4

(mock_current, mock_historical) = mock_bq.call_args_list

actual_current_df, _, table_name = mock_current[0]
Expand All @@ -107,5 +118,18 @@ def test_write_to_bq_youth_by_race_state(

assert mock_bq.call_count == 2

actual_current_df = actual_current_df.sort_values(by=['race_and_ethnicity', 'state_name']).reset_index(drop=True)
expected_current_df = expected_current_df.sort_values(by=['race_and_ethnicity', 'state_name']).reset_index(
drop=True
)

assert_frame_equal(actual_current_df, expected_current_df, check_like=True)

actual_historical_df = actual_historical_df.sort_values(
by=['time_period', 'race_and_ethnicity', 'state_name']
).reset_index(drop=True)
expected_historical_df = expected_historical_df.sort_values(
by=['time_period', 'race_and_ethnicity', 'state_name']
).reset_index(drop=True)

assert_frame_equal(actual_historical_df, expected_historical_df, check_like=True)

0 comments on commit 6e9406f

Please sign in to comment.