Skip to content

Commit

Permalink
fix setter decorators for some coreneuron attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
WeinaJi committed Mar 14, 2024
1 parent 17be061 commit 1f4c2c9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
8 changes: 4 additions & 4 deletions share/lib/python/neuron/coreneuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def model_path(self):
"""Data path of the model."""
return self._model_path

@sim_config.setter
@model_path.setter
def model_path(self, value):
self._model_path = str(value)

Expand All @@ -244,7 +244,7 @@ def save_path(self):
"""Data path for save."""
return self._save_path

@sim_config.setter
@save_path.setter
def save_path(self, value):
self._save_path = str(value)

Expand All @@ -253,7 +253,7 @@ def restore_path(self):
"""Data path for restore."""
return self._restore_path

@sim_config.setter
@restore_path.setter
def restore_path(self, value):
self._restore_path = str(value)

Expand All @@ -268,7 +268,7 @@ def skip_write_model_to_disk(self):
"""
return self._skip_write_model_to_disk

@sim_config.setter
@skip_write_model_to_disk.setter
def skip_write_model_to_disk(self, value):
self._skip_write_model_to_disk = value

Expand Down
22 changes: 22 additions & 0 deletions test/pytest_coreneuron/test_coreneuron_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from neuron import coreneuron


def test_coreneuron_configuration():
assert coreneuron.restore_path is None
assert coreneuron.save_path is None
assert coreneuron.model_path is None
assert coreneuron.skip_write_model_to_disk == False

coreneuron.restore_path = "restore"
coreneuron.save_path = "save"
coreneuron.model_path = "coredat"
coreneuron.skip_write_model_to_disk = True

assert coreneuron.restore_path == "restore"
assert coreneuron.save_path == "save"
assert coreneuron.model_path == "coredat"
assert coreneuron.skip_write_model_to_disk == True


if __name__ == "__main__":
test_coreneuron_configuration()

0 comments on commit 1f4c2c9

Please sign in to comment.