Skip to content

Commit

Permalink
add test for filters
Browse files Browse the repository at this point in the history
  • Loading branch information
nulinspiratie committed Nov 19, 2024
1 parent d619f12 commit ab38388
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/components/ports/test_lf_fem_analog_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,52 @@ def test_lf_fem_analog_output_port():
}


def test_fem_analog_output_port_filter():
port = LFFEMAnalogOutputPort("con1", 1, 2)
port.feedforward_filter = None
port.feedback_filter = None

assert port.get_port_properties() == {
"delay": 0,
"shareable": False,
"output_mode": "direct",
"sampling_rate": 1e9,
"upsampling_mode": "mw",
}

port.feedforward_filter = [0.7, 0.2, 0.1]

assert port.get_port_properties() == {
"delay": 0,
"shareable": False,
"output_mode": "direct",
"sampling_rate": 1e9,
"upsampling_mode": "mw",
"filter": {"feedforward": [0.7, 0.2, 0.1]},
}

port.feedback_filter = [0.3, 0.4, 0.5]

assert port.get_port_properties() == {
"delay": 0,
"shareable": False,
"output_mode": "direct",
"sampling_rate": 1e9,
"upsampling_mode": "mw",
"filter": {"feedforward": [0.7, 0.2, 0.1], "feedback": [0.3, 0.4, 0.5]},
}

port.feedforward_filter = None
assert port.get_port_properties() == {
"delay": 0,
"shareable": False,
"output_mode": "direct",
"sampling_rate": 1e9,
"upsampling_mode": "mw",
"filter": {"feedback": [0.3, 0.4, 0.5]},
}


def test_lf_fem_analog_input_port():
with pytest.raises(TypeError):
LFFEMAnalogInputPort()
Expand Down

0 comments on commit ab38388

Please sign in to comment.