Skip to content

Commit

Permalink
change warning catch
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Dec 11, 2024
1 parent 491d994 commit 80dcca5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/quam_base/referencing/test_quam_root_referencing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from quam import QuamRoot, QuamComponent, quam_dataclass
import pytest
import warnings


@quam_dataclass
Expand All @@ -14,23 +14,19 @@ class Root(QuamRoot):


def test_quam_root_reference():
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
root = Root(a=Component())
assert root.a is root.b

# Ensure no warnings were raised
assert len(record) == 0


def test_quam_root_reference_to_dict():
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
root = Root(a="#/b", b=Component())
d = root.to_dict()
assert d == {
"a": "#/b",
"b": {},
"__class__": "test_quam_root_referencing.Root",
}

# Ensure no warnings were raised
assert len(record) == 0

0 comments on commit 80dcca5

Please sign in to comment.