diff --git a/brian2/tests/test_neurongroup.py b/brian2/tests/test_neurongroup.py index b307957a9..ff8fb7aa5 100644 --- a/brian2/tests/test_neurongroup.py +++ b/brian2/tests/test_neurongroup.py @@ -1120,25 +1120,25 @@ def test_state_variables(): # Calculating with state variables should work too # With units - assert all(G.v - G.v == 0) - assert all(G.v - G.v[:] == 0 * mV) - assert all(G.v[:] - G.v == 0 * mV) - assert all(G.v + 70 * mV == G.v[:] + 70 * mV) - assert all(70 * mV + G.v == G.v[:] + 70 * mV) - assert all(G.v + G.v == 2 * G.v) - assert all(G.v / 2.0 == 0.5 * G.v) - assert all(1.0 / G.v == 1.0 / G.v[:]) + assert_allclose(G.v - G.v, 0 * mV) + assert_allclose(G.v - G.v[:], 0 * mV) + assert_allclose(G.v[:] - G.v, 0 * mV) + assert_allclose(G.v + 70 * mV, G.v[:] + 70 * mV) + assert_allclose(70 * mV + G.v, G.v[:] + 70 * mV) + assert_allclose(G.v + G.v, 2 * G.v) + assert_allclose(G.v / 2.0, 0.5 * G.v) + assert_allclose(1.0 / G.v, 1.0 / G.v[:]) assert_allclose((-G.v)[:], -G.v[:]) assert_allclose((+G.v)[:], G.v[:]) # Without units - assert all(G.v_ - G.v_ == 0) - assert all(G.v_ - G.v_[:] == 0) - assert all(G.v_[:] - G.v_ == 0) - assert all(G.v_ + float(70 * mV) == G.v_[:] + float(70 * mV)) - assert all(float(70 * mV) + G.v_ == G.v_[:] + float(70 * mV)) - assert all(G.v_ + G.v_ == 2 * G.v_) - assert all(G.v_ / 2.0 == 0.5 * G.v_) - assert all(1.0 / G.v_ == 1.0 / G.v_[:]) + assert_allclose(G.v_ - G.v_, 0) + assert_allclose(G.v_ - G.v_[:], 0) + assert_allclose(G.v_[:] - G.v_, 0) + assert_allclose(G.v_ + float(70 * mV), G.v_[:] + float(70 * mV)) + assert_allclose(float(70 * mV) + G.v_, G.v_[:] + float(70 * mV)) + assert_allclose(G.v_ + G.v_, 2 * G.v_) + assert_allclose(G.v_ / 2.0, 0.5 * G.v_) + assert_allclose(1.0 / G.v_, 1.0 / G.v_[:]) assert_allclose((-G.v)[:], -G.v[:]) assert_allclose((+G.v)[:], G.v[:])