Skip to content

Commit

Permalink
Add some additional targetted testing on param creation
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Aug 20, 2024
1 parent 304440e commit 7467e1e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/input/one_node_fp_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@
}
}
}
}
}
26 changes: 26 additions & 0 deletions tests/test_introspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,29 @@ async def get_plugins(idx: int):
controller = FrameProcessorAdapterController(mock_connection, parameters, "prefix")
await controller.initialise()
assert all(fpx in controller.get_sub_controllers() for fpx in ("FP0", "FP1"))


def test_node_with_empty_list_is_correctly_counted():
parameters = create_odin_parameters({"test": []})
names = [p.name for p in parameters]
assert "test" in names
assert len(parameters) == 1


def test_node_that_has_metadata_only_counts_once():
data = {"count": {"value": 1, "writeable": False, "type": "int"}}
parameters = create_odin_parameters(data)
assert len(parameters) == 1


def test_nested_node_gives_correct_name():
data = {"top": {"nest-1": {"nest-2": 1}}}
parameters = create_odin_parameters(data)
assert len(parameters) == 1
assert parameters[0].name == "top_nest-1_nest-2"


def test_config_node_splits_list_into_mutiples():
data = {"config": {"param": [1, 2]}}
parameters = create_odin_parameters(data)
assert len(parameters) == 2

0 comments on commit 7467e1e

Please sign in to comment.