Skip to content

Commit c862a94

Browse files
committed
refactor: streamline cache access in minor_trace_chemistry_transfer
1 parent eccce9b commit c862a94

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

tests/test_minor_trace_chemistry_transfer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
def test_row_to_dict_includes_wclab_id():
9+
# Bypass __init__ so we can stub the cache without hitting the DB.
910
transfer = MinorTraceChemistryTransferer.__new__(MinorTraceChemistryTransferer)
1011
sample_pt_id = uuid.uuid4()
1112
transfer._sample_pt_ids = {sample_pt_id}

transfers/minor_trace_chemistry_transfer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ def _row_to_dict(self, row) -> Optional[dict[str, Any]]:
177177
return None
178178

179179
# Look up Integer FK from cache
180-
cache = getattr(self, "_sample_info_cache", None)
181-
if cache is None:
182-
cache = {}
183-
chemistry_sample_info_id = cache.get(legacy_sample_pt_id)
180+
chemistry_sample_info_id = self._sample_info_cache.get(legacy_sample_pt_id)
184181
if chemistry_sample_info_id is None:
185182
self._capture_error(
186183
legacy_sample_pt_id,

0 commit comments

Comments
 (0)