Commit 6e42db53 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Fixed unitary test on optical slots
parent 856cfb0b
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -44,20 +44,22 @@ def build_sparse_slot_input(active_slots):


@pytest.mark.parametrize(
    'slot_type,start_slot,width,active_slots',
    'slot_type,active_slots',
    [
        (C_Slot(), 0, 320, [0, 17, 319]),
        (L_Slot(), 0, 550, [0, 101, 549]),
        (S_Slot(), 0, 720, [0, 205, 719]),
        (C_Slot(), [0, 17, 319]),
        (L_Slot(), [0, 101, 549]),
        (S_Slot(), [0, 205, 719]),
    ],
)
def test_slot_type_roundtrip_preserves_positions(slot_type, width, active_slots) -> None:
def test_slot_type_roundtrip_preserves_positions(slot_type, active_slots) -> None:
    sparse_input = build_sparse_slot_input(active_slots)
    encoded = slot_type.process_bind_param(sparse_input, dialect=None)
    decoded = slot_type.process_result_value(encoded, dialect=None)

    assert encoded is not None
    assert decoded == build_expected_slot_map(slot_type.start_point, width, active_slots)
    assert decoded == build_expected_slot_map(
        slot_type.start_point, slot_type.width, active_slots
    )


@pytest.mark.parametrize(