From 5749976a64ceba475b1c0222443195ee053e30ab Mon Sep 17 00:00:00 2001 From: a_corni Date: Mon, 27 Nov 2023 17:03:34 +0100 Subject: [PATCH] Test de- & serializ. of dev with total_bottom_det --- tests/test_abstract_repr.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/test_abstract_repr.py b/tests/test_abstract_repr.py index 47d4c8b60..4ce3431d8 100644 --- a/tests/test_abstract_repr.py +++ b/tests/test_abstract_repr.py @@ -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