Skip to content

Commit

Permalink
test(nml.py): test new "Component" usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Aug 1, 2024
1 parent 3fcfb7b commit ebacfb6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions neuroml/test/test_nml.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,32 @@ def test_class_hierarchy(self):
print()
print_hierarchy(hier)

def test_new_component(self):
"""Test adding a Component"""
comp = component_factory(
"Component", id="test", type="test_type", some_arg="5 mV"
)
comp_str = str(comp)
print(comp_str)
self.assertIn('some_arg="5 mV"', comp_str)

newdoc = component_factory("NeuroMLDocument", id="newdoc")
newdoc.add("Component", id="another", type="another_type", another_arg="15 pS")
newdoc_str = str(newdoc)
self.assertIn('another_arg="15 pS"', newdoc_str)
print(newdoc_str)

cell = component_factory("Cell", id="simple_cell") # type: neuroml.Cell
cell.set_spike_thresh("40mV")
cell.set_init_memb_potential("-70mV")
cell.set_specific_capacitance("1 uF_per_cm2")
cell.add_membrane_property(
"Component", id="test_comp", type="test_type", value="10 mV"
)
cell_str = str(cell)
self.assertIn('value="10 mV"', cell_str)
print(cell_str)


if __name__ == "__main__":
ta = TestNML()
Expand Down

0 comments on commit ebacfb6

Please sign in to comment.