Skip to content

Commit

Permalink
fix regex test
Browse files Browse the repository at this point in the history
  • Loading branch information
katduecker committed Nov 5, 2024
1 parent e1f5c66 commit 321f589
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 2 additions & 4 deletions hnn_core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,10 +1691,8 @@ def _add_cell_type_bias(network: Network, amplitude: Union[float, dict],

# error when section is defined that doesn't exist.
if section not in sections:
print(f"section must be one of "
f"{sections}. Got {section}.")
raise ValueError(f"section must be one of "
f"{sections}. Got {section}.")
raise ValueError(f"section must be one of {sections}. "
f"Got {section}.")
else:
cell_type_bias['section'] = section

Expand Down
7 changes: 2 additions & 5 deletions hnn_core/tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
from numpy.testing import assert_allclose
import pytest
import re

import hnn_core
from hnn_core import read_params, CellResponse, Network
Expand Down Expand Up @@ -869,10 +868,8 @@ def test_tonic_biases():
# non-existent section
net.external_biases = dict()

sections = list(net.cell_types['L2_pyramidal'].sections.keys())
with pytest.raises(ValueError, match=re.escape(f"section must be one of "
f"{sections}."
f"Got apical_4.")):
with pytest.raises(ValueError, match=('section must be one of ' + r".*" +
' Got apical_4.')):
net.add_tonic_bias(amplitude={'L2_pyramidal': .5}, section='apical_4')


Expand Down

0 comments on commit 321f589

Please sign in to comment.