Skip to content

Commit

Permalink
try to import ComplexWarning from np.exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot committed Oct 13, 2024
1 parent 8bdf3b1 commit 3f7288d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from geoana.utils import check_xyz_dim, mkvc, ndgrid
import pytest

try:
from numpy.exceptions import ComplexWarning
except ImportError:
from numpy import ComplexWarning


def test_config_info():
info = geoana.show_config()
Expand Down Expand Up @@ -95,7 +100,7 @@ def test_dtype_cast_good():

def test_bad_dtype_cast():
xyz = np.random.rand(10, 3) + 1j* np.random.rand(10, 3)
with pytest.warns(np.ComplexWarning):
with pytest.warns(ComplexWarning):
xyz2 = check_xyz_dim(xyz)
xyz = [['0', 'O', 'o']]
with pytest.raises(ValueError):
Expand Down

0 comments on commit 3f7288d

Please sign in to comment.