Skip to content

Commit 02100a6

Browse files
committed
feat: add _next_global_id function and assign global_id in NMAMinorTraceChemistry instances
1 parent 1096d5a commit 02100a6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_nma_chemistry_lineage.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def _next_sample_point_id() -> str:
4747
return f"SP-{uuid4().hex[:7]}"
4848

4949

50+
def _next_global_id():
51+
return uuid4()
52+
53+
5054
@pytest.fixture(scope="module")
5155
def shared_well():
5256
"""Create a single Thing for all tests in this module."""
@@ -140,6 +144,7 @@ def test_nma_minor_trace_chemistry_save_all_columns(shared_well):
140144
session.commit()
141145

142146
mtc = NMAMinorTraceChemistry(
147+
global_id=_next_global_id(),
143148
chemistry_sample_info=sample_info,
144149
analyte="As",
145150
sample_value=0.015,
@@ -334,6 +339,7 @@ def test_assign_sample_info_to_mtc(shared_well):
334339
session.commit()
335340

336341
mtc = NMAMinorTraceChemistry(
342+
global_id=_next_global_id(),
337343
analyte="As",
338344
sample_value=0.01,
339345
units="mg/L",
@@ -368,6 +374,7 @@ def test_append_mtc_to_sample_info(shared_well):
368374
session.commit()
369375

370376
mtc = NMAMinorTraceChemistry(
377+
global_id=_next_global_id(),
371378
analyte="U",
372379
sample_value=15.2,
373380
units="ug/L",
@@ -428,6 +435,7 @@ def test_full_lineage_navigation(shared_well):
428435
session.commit()
429436

430437
mtc = NMAMinorTraceChemistry(
438+
global_id=_next_global_id(),
431439
analyte="Se",
432440
sample_value=0.005,
433441
units="mg/L",
@@ -461,6 +469,7 @@ def test_reverse_lineage_navigation(shared_well):
461469
session.commit()
462470

463471
mtc = NMAMinorTraceChemistry(
472+
global_id=_next_global_id(),
464473
analyte="Pb",
465474
sample_value=0.002,
466475
units="mg/L",
@@ -508,6 +517,7 @@ def test_cascade_delete_sample_info_deletes_mtc(shared_well):
508517
for analyte in ["As", "U", "Se", "Pb"]:
509518
sample_info.minor_trace_chemistries.append(
510519
NMAMinorTraceChemistry(
520+
global_id=_next_global_id(),
511521
analyte=analyte,
512522
sample_value=0.01,
513523
units="mg/L",
@@ -629,6 +639,7 @@ def test_multiple_mtc_per_sample_info(shared_well):
629639
for analyte in analytes:
630640
sample_info.minor_trace_chemistries.append(
631641
NMAMinorTraceChemistry(
642+
global_id=_next_global_id(),
632643
analyte=analyte,
633644
sample_value=0.01,
634645
units="mg/L",

0 commit comments

Comments
 (0)