From 5f1fc28a8d2ad319673226a5d9956aedfd05090e Mon Sep 17 00:00:00 2001 From: lucasmbrown-usds Date: Fri, 9 Sep 2022 12:27:28 -0400 Subject: [PATCH] fixing tests --- .../data_pipeline/etl/score/etl_utils.py | 12 +++++++++--- .../data_pipeline/etl/score/tests/test_etl_utils.py | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/data/data-pipeline/data_pipeline/etl/score/etl_utils.py b/data/data-pipeline/data_pipeline/etl/score/etl_utils.py index 13f2dc70..5f7b6ecd 100644 --- a/data/data-pipeline/data_pipeline/etl/score/etl_utils.py +++ b/data/data-pipeline/data_pipeline/etl/score/etl_utils.py @@ -332,7 +332,10 @@ def compare_to_list_of_expected_state_fips_codes( continental_us_expected (bool, optional): Do you expect the continental nation (DC & states except for Alaska and Hawaii) to be represented in data? alaska_and_hawaii_expected (bool, optional): Do you expect Alaska and Hawaii - to be represented in the data? + to be represented in the data? Note: if only *1* of Alaska and Hawaii are + not expected to be included, do not use this argument -- instead, + use `additional_fips_codes_not_expected` for the 1 state you expected to + be missing. puerto_rico_expected (bool, optional): Do you expect PR to be represented in data? island_areas_expected (bool, optional): Do you expect Island Areas to be represented in data? @@ -365,9 +368,12 @@ def compare_to_list_of_expected_state_fips_codes( TILES_CONTINENTAL_US_FIPS_CODE ) - # If Alaska and Hawaii are not expected to be included, remove them from the + # If both Alaska and Hawaii are not expected to be included, remove them from the # expected states set. - if not continental_us_expected: + # Note: if only *1* of Alaska and Hawaii are not expected to be included, + # do not use this argument -- instead, use `additional_fips_codes_not_expected` + # for the 1 state you expected to be missing. + if not alaska_and_hawaii_expected: expected_states_set = expected_states_set - set( TILES_ALASKA_AND_HAWAII_FIPS_CODE ) diff --git a/data/data-pipeline/data_pipeline/etl/score/tests/test_etl_utils.py b/data/data-pipeline/data_pipeline/etl/score/tests/test_etl_utils.py index 44a3157f..ed33c63e 100644 --- a/data/data-pipeline/data_pipeline/etl/score/tests/test_etl_utils.py +++ b/data/data-pipeline/data_pipeline/etl/score/tests/test_etl_utils.py @@ -198,7 +198,7 @@ def test_compare_to_list_of_expected_state_fips_codes(): additional_fips_codes_not_expected=["23", "55"], ) - # Missing the nation + # Missing the continental & AK/HI nation fips_codes_test_4 = [ "60", "66", @@ -223,7 +223,9 @@ def test_compare_to_list_of_expected_state_fips_codes(): assert partial_expected_error_message in str(exception_info.value) - # Should not raise error because Nation is not to be missing + # Should not raise error because continental US and AK/HI is not to be missing compare_to_list_of_expected_state_fips_codes( - actual_state_fips_codes=fips_codes_test_4, continental_us_expected=False + actual_state_fips_codes=fips_codes_test_4, + continental_us_expected=False, + alaska_and_hawaii_expected=False, )