Skip to content

Commit

Permalink
negative room or cage (#146)
Browse files Browse the repository at this point in the history
* negative room or cage

* removes accidental change in pyproject.toml
  • Loading branch information
mekhlakapoor authored Oct 6, 2023
1 parent 5d710c6 commit 341ed16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/aind_metadata_service/labtracks/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,11 @@ def _map_housing(
-------
Optional[Housing]
"""
if room_id is None and cage_id is None:
return None
else:
housing = Housing.construct(
room_id=room_id if room_id else None,
cage_id=cage_id if cage_id else None,
)
return housing
room_id = None if room_id is None or int(room_id) < 0 else room_id
cage_id = None if cage_id is None or int(cage_id) < 0 else cage_id

return Housing.construct(room_id=room_id,
cage_id=cage_id) if room_id is not None or cage_id is not None else None

def map_response_to_subject(self, results: List[dict]) -> List[Subject]:
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/labtracks/test_response_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def test_map_housing(self):
housing3 = Housing.construct(cage_id="1234")
housing4 = Housing.construct(room_id="000", cage_id="1234")

subject_housing1 = self.rh._map_housing(room_id=None, cage_id=None)
subject_housing1 = self.rh._map_housing(room_id="-99999999999", cage_id=None)
subject_housing2 = self.rh._map_housing(room_id="000", cage_id=None)
subject_housing3 = self.rh._map_housing(room_id=None, cage_id="1234")
subject_housing4 = self.rh._map_housing(room_id="000", cage_id="1234")
Expand Down

0 comments on commit 341ed16

Please sign in to comment.