Skip to content

Commit

Permalink
Test de- & serializ. of dev with total_bottom_det
Browse files Browse the repository at this point in the history
  • Loading branch information
a-corni committed Nov 27, 2023
1 parent 1e84c39 commit 5749976
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/test_abstract_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,13 +1055,25 @@ def _get_expression(op: dict) -> Any:


class TestDeserialization:
def test_deserialize_device_and_channels(self) -> None:
s = _get_serialized_seq()
with pytest.warns(DeprecationWarning, match="From v0.17 and onwards,"):
@pytest.mark.parametrize("is_phys_Chadoq2", [True, False])
def test_deserialize_device_and_channels(self, is_phys_Chadoq2) -> None:
kwargs = {}
if is_phys_Chadoq2:
kwargs["device"] = json.loads(phys_Chadoq2.to_abstract_repr())
s = _get_serialized_seq(**kwargs)
if not is_phys_Chadoq2:
with pytest.warns(
DeprecationWarning, match="From v0.17 and onwards,"
):
_check_roundtrip(s)
seq = Sequence.from_abstract_repr(json.dumps(s))
deserialized_device = deserialize_device(
json.dumps(s["device"])
)
else:
_check_roundtrip(s)
seq = Sequence.from_abstract_repr(json.dumps(s))
deserialized_device = deserialize_device(json.dumps(s["device"]))

# Check device
assert seq._device == deserialized_device

Expand Down

0 comments on commit 5749976

Please sign in to comment.