Skip to content

Commit

Permalink
add load_component test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaquier Aurélien Tristan committed Aug 23, 2024
1 parent f9ac053 commit d1758ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
4 changes: 4 additions & 0 deletions bluepyopt/tests/test_ephys/test_create_acc.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ def check_acc_dir(test_dir, ref_dir):
with open(ref_dir_file / file) as f:
ref_file = f.read()
assert ref_file == test_file
# check that load_component is not raising any error here
fpath = pathlib.Path(test_dir) / file
if fpath.suffix == "acc":
arbor.load_component(fpath).component


@pytest.mark.unit
Expand Down
17 changes: 2 additions & 15 deletions bluepyopt/tests/test_ephys/test_parameterscalers.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,5 @@ def test_parameterscalers_iexpr():
decor_filename = pathlib.Path(test_dir).joinpath("decor.acc")
with open(decor_filename, "w") as f:
f.write(simple_cell_decor_with_iexpr)
test_decor = arbor.load_component(decor_filename).component
assert test_decor.defaults() == []
assert test_decor.placements() == []
assert len(test_decor.paintings()) == 2
assert test_decor.paintings()[0][0] == '(region "soma")'
assert str(test_decor.paintings()[0][1]) == 'Cm=0.01'
assert test_decor.paintings()[1][0] == '(region "soma")'
scaled_mech_str = "<arbor.scaled_mechanism<density> " \
"(mechanism('default::hh', %s), " \
'{"gkbar": (sub (scalar 0.621094) (mul (log (scalar 3.14159)) ' \
'(exp (div (distance 1 (region "soma")) ' \
'(scalar 0.421875)))))})>'
str1 = scaled_mech_str % '{"gkbar": 0.0271248, "gnabar": 0.102993}'
str2 = scaled_mech_str % '{"gnabar": 0.102993, "gkbar": 0.0271248}'
assert str(test_decor.paintings()[1][1]) in [str1, str2]
# check that load_component is not raising any error here
arbor.load_component(decor_filename).component

0 comments on commit d1758ba

Please sign in to comment.