Skip to content

Commit

Permalink
Fix 260 tars strip (#291)
Browse files Browse the repository at this point in the history
* strips white spaces from input to tars endpoint
  • Loading branch information
mekhlakapoor authored Oct 31, 2024
1 parent 0f11561 commit 792475a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/aind_metadata_service/tars/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/tars/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 792475a

Please sign in to comment.