From 792475a421205cfe36d18ab22bfa8dfa9935436e Mon Sep 17 00:00:00 2001 From: Mekhla Kapoor <54870020+mekhlakapoor@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:05:22 -0700 Subject: [PATCH] Fix 260 tars strip (#291) * strips white spaces from input to tars endpoint --- src/aind_metadata_service/tars/mapping.py | 4 ++-- tests/tars/test_mapping.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aind_metadata_service/tars/mapping.py b/src/aind_metadata_service/tars/mapping.py index 56c2f2b3..9fd93f19 100644 --- a/src/aind_metadata_service/tars/mapping.py +++ b/src/aind_metadata_service/tars/mapping.py @@ -223,7 +223,7 @@ def get_virus_strains(response: ModelResponse) -> List: and procedure.injection_materials ): virus_strains = [ - getattr(material, "name") + getattr(material, "name").strip() for material in procedure.injection_materials ] viruses.extend(virus_strains) @@ -253,7 +253,7 @@ def integrate_injection_materials( if isinstance( injection_material, ViralMaterial ) and hasattr(injection_material, "name"): - virus_strain = injection_material.name + virus_strain = injection_material.name.strip() tars_response = tars_mapping.get(virus_strain) if ( tars_response.status_code diff --git a/tests/tars/test_mapping.py b/tests/tars/test_mapping.py index 05975cd4..1fae9931 100644 --- a/tests/tars/test_mapping.py +++ b/tests/tars/test_mapping.py @@ -28,10 +28,10 @@ class TestTarsResponseHandler(unittest.TestCase): handler = TarsResponseHandler() inj1 = NanojectInjection.model_construct( - injection_materials=[ViralMaterial.model_construct(name="12345")] + injection_materials=[ViralMaterial.model_construct(name="\n12345 ")] ) inj2 = NanojectInjection.model_construct( - injection_materials=[ViralMaterial.model_construct(name="67890")] + injection_materials=[ViralMaterial.model_construct(name=" 67890\t")] ) surgery = Surgery.model_construct(procedures=[inj1, inj2]) procedures_response = ModelResponse(