From 321f589b8c9702cfa37a79084d342a256d5ee941 Mon Sep 17 00:00:00 2001 From: katduecker Date: Tue, 5 Nov 2024 10:58:21 -0500 Subject: [PATCH] fix regex test --- hnn_core/network.py | 6 ++---- hnn_core/tests/test_network.py | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hnn_core/network.py b/hnn_core/network.py index 8e56b297a..3e1db731d 100644 --- a/hnn_core/network.py +++ b/hnn_core/network.py @@ -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 diff --git a/hnn_core/tests/test_network.py b/hnn_core/tests/test_network.py index 36323ff8d..817d4090b 100644 --- a/hnn_core/tests/test_network.py +++ b/hnn_core/tests/test_network.py @@ -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 @@ -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')