From 4f3627363462326446085e7cb615184a5cfda74f Mon Sep 17 00:00:00 2001 From: Osneil Drakes Date: Wed, 11 Sep 2024 10:52:58 +0100 Subject: [PATCH] style : make outputs a bit more clearer --- gcf_data_mapper/parsers/family.py | 6 ++++-- tests/unit_tests/parsers/family/test_map_family.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcf_data_mapper/parsers/family.py b/gcf_data_mapper/parsers/family.py index 34fd168..6535364 100644 --- a/gcf_data_mapper/parsers/family.py +++ b/gcf_data_mapper/parsers/family.py @@ -166,16 +166,18 @@ def map_family_data( """ family_metadata = map_family_metadata(row) + projects_id = row.at[FamilyColumnsNames.PROJECTS_ID.value] # When processing the family metadata if there are any empty/falsy values we return None # and skip the row. Therefore we don't want to process the rest of the family data so we # return None in this conditional. if family_metadata is None: - click.echo("🛑 Skipping row as family metadata has missing information") + click.echo( + f"🛑 Skipping row as family metadata has missing information, ProjectsID : {projects_id}" + ) return None approved_ref = row.at[FamilyColumnsNames.APPROVED_REF.value] - projects_id = row.at[FamilyColumnsNames.PROJECTS_ID.value] summary = row.at[FamilyColumnsNames.SUMMARY.value] title = row.at[FamilyColumnsNames.TITLE.value] diff --git a/tests/unit_tests/parsers/family/test_map_family.py b/tests/unit_tests/parsers/family/test_map_family.py index 6ca122c..e9f20a9 100644 --- a/tests/unit_tests/parsers/family/test_map_family.py +++ b/tests/unit_tests/parsers/family/test_map_family.py @@ -152,8 +152,9 @@ def test_skips_processing_row_if_row_contains_empty_values( def test_skips_processing_row_if_family_metadata_has_missing_data( - mock_family_row_no_result_areas, capsys + mock_family_row_no_result_areas: pd.Series, capsys ): + projects_id = mock_family_row_no_result_areas.ProjectsID family_data = map_family_data(mock_family_row_no_result_areas) assert family_data is None captured = capsys.readouterr() @@ -161,6 +162,6 @@ def test_skips_processing_row_if_family_metadata_has_missing_data( # from map_family_data informing that the row is being skipped map_family_data_output = captured.out.strip().split("\n") assert ( - "🛑 Skipping row as family metadata has missing information" + f"🛑 Skipping row as family metadata has missing information, ProjectsID : {projects_id}" == map_family_data_output[1] )