diff --git a/hnn_core/tests/test_dipole.py b/hnn_core/tests/test_dipole.py index 538f34ff9..f3ea26cbd 100644 --- a/hnn_core/tests/test_dipole.py +++ b/hnn_core/tests/test_dipole.py @@ -45,6 +45,8 @@ def test_dipole(tmpdir, run_hnn_core_fixture): # Test wrong argument to plot_dipole() with pytest.raises(TypeError, match='dpl must be an instance of'): plot_dipole([dipole, 10], show=False) + with pytest.raises(AttributeError, match="object has no attribute 'append"): + plot_dipole(np.array([dipole, dipole]), average=True, show=False) # Test IO dipole.write(dpl_out_fname) diff --git a/hnn_core/viz.py b/hnn_core/viz.py index 9c04c4fc9..87fde29d6 100644 --- a/hnn_core/viz.py +++ b/hnn_core/viz.py @@ -274,7 +274,7 @@ def plot_dipole(dpl, tmin=None, tmax=None, ax=None, layer='agg', decim=None, _validate_type(this_dpl, Dipole, 'dpl', 'Dipole, list of Dipole') if average: - dpl = dpl + [average_dipoles(dpl)] + dpl.append(average_dipoles(dpl)) scale_applied = dpl[0].scale_applied