Skip to content

Commit 29f29f3

Browse files
committed
more tests
1 parent 81f5f9e commit 29f29f3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/test_mixes.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ def test_component():
114114

115115
assert Component("A") != 5
116116

117+
assert Component("A").is_mix == False
118+
117119

118120
def test_component_allcomps():
119121
ac = Component("A", 1 * uM).all_components()
@@ -228,6 +230,8 @@ def test_a_mix(reference: Reference):
228230
fixed_concentration="strand3",
229231
).with_reference(reference)
230232

233+
assert m.is_mix
234+
231235
assert m.buffer_volume == ureg("5 uL")
232236
assert m.concentration == ureg("400 nM")
233237

@@ -495,6 +499,40 @@ def assert_close(
495499
# what happens with the default rtol parameter of pint.testing.assert_allclose.
496500
pint.testing.assert_allclose(actual, expected, rtol, atol, msg) # type: ignore
497501

502+
def test_mix_conflicting_fills_and_fixed_total_volume():
503+
from riverine import FixedConcentration, FixedVolume, Mix, Strand, FillToVolume
504+
505+
506+
with pytest.raises(ValueError):
507+
m = Mix(
508+
actions=[FillToVolume("Buffer", "100 uL"), FixedConcentration(components=[Component("A", "100 nM")], fixed_concentration="10 nM")],
509+
name="test",
510+
fixed_total_volume="100 uL",
511+
)
512+
513+
def test_set_fixed_total_volume_after_init():
514+
from riverine import FixedConcentration, FixedVolume, Mix, Strand, FillToVolume
515+
516+
m = Mix(
517+
actions=[FillToVolume("Buffer", "100 uL")],
518+
name="test",
519+
)
520+
m.fixed_total_volume = "150 uL"
521+
assert m.fixed_total_volume == Q_("150 uL")
522+
523+
m.buffer_name = "Buffer2"
524+
525+
assert m.buffer_name == "Buffer2"
526+
assert m.actions[0].components[0].name == "Buffer2"
527+
528+
def test_no_buffer_volume():
529+
# FixedVolume only actions, no buffer
530+
531+
m = Mix(
532+
actions=[FixedVolume(components=[Component("A", "100 nM")], fixed_volume="100 uL")],
533+
name="test",
534+
)
535+
assert m.buffer_volume == Q_("0 uL")
498536

499537
def test_split_mix():
500538
from riverine import FixedConcentration, FixedVolume, Mix, Strand, split_mix

0 commit comments

Comments
 (0)