Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu committed Feb 1, 2024
1 parent 84c7da1 commit efbf7c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions test/pytest_coreneuron/test_nlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,28 @@ def run(self):
return res


def test_nlayer():
def get_result():
res = []
for nlayer in [1, 2, 3]:
h.nlayer_extracellular(nlayer)
assert nlayer == int(h.nlayer_extracellular())
m = Model()
res.append(m.run())
del m
return res


def test_nlayer():
res = get_result()
for r in res[1:]:
for i in range(2):
x = r[i].c().sub(res[0][i]).abs().sum()
print(x)
assert x < 0.01 # At 10ms. At 5ms would be 2e-5
return res


if __name__ == "__main__":
res = test_nlayer()
res = get_result()
for i in range(len(res[0][0])):
for j in range(2):
for k in range(3):
Expand Down
8 changes: 4 additions & 4 deletions test/pytest_coreneuron/test_vector_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,10 @@ def test_vector_api():
vrand = h.Vector((1, 2, 3))
r = h.Random()
r.poisson(12)
assert vrand.cl().setrand(r).to_python() == [10.0, 16.0, 11.0]
assert vrand.cl().setrand(r, 1, 2).to_python() == [1.0, 9.0, 18.0]
assert vrand.cl().addrand(r).to_python() == [9.0, 9.0, 16.0]
assert vrand.cl().addrand(r, 0, 1).to_python() == [13.0, 16.0, 3.0]
assert vrand.cl().setrand(r).to_python() == [22.0, 16.0, 16.0]
assert vrand.cl().setrand(r, 1, 2).to_python() == [1.0, 8.0, 12.0]
assert vrand.cl().addrand(r).to_python() == [7.0, 13.0, 12.0]
assert vrand.cl().addrand(r, 0, 1).to_python() == [9.0, 16.0, 3.0]

"""
Misc
Expand Down

0 comments on commit efbf7c5

Please sign in to comment.