Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Dec 4, 2024
1 parent a0395a7 commit 107f3ab
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/quam_base/test_set_at_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ class RootQuam(QuamRoot):
def test_set_at_reference():
"""Test setting a value through a reference"""
parent = ParentQuam(child=ChildQuam())

# Set value through reference
return_val = parent.set_at_reference("ref_value", 123)
parent.set_at_reference("ref_value", 123)

assert return_val == "#./child/value"

# Check that the value was set correctly
assert parent.child.value == 123
# Reference string should remain unchanged
Expand All @@ -38,7 +36,7 @@ def test_set_at_reference():
def test_set_at_reference_non_reference():
"""Test that setting a non-reference attribute raises ValueError"""
parent = ParentQuam(child=ChildQuam())

with pytest.raises(ValueError, match="is not a reference"):
parent.set_at_reference("normal_value", 123)

Expand All @@ -61,10 +59,10 @@ def test_unreferenced_value():
def test_set_at_absolute_reference():
"""Test setting a value through an absolute reference"""
root = RootQuam(parent=ParentQuam(child=ChildQuam()))

# Set value through absolute reference
root.set_at_reference("abs_ref", 456)

# Check that the value was set correctly
assert root.parent.child.value == 456
# Reference string should remain unchanged
Expand All @@ -75,6 +73,6 @@ def test_set_at_absolute_reference_invalid():
"""Test handling of invalid absolute references"""
root = RootQuam(parent=ParentQuam(child=ChildQuam()))
root.abs_ref = "#/nonexistent/path"

with pytest.raises(AttributeError):
root.set_at_reference("abs_ref", 456)

0 comments on commit 107f3ab

Please sign in to comment.