1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
From: Ole Streicher <olebole@debian.org>
Date: Wed, 19 Apr 2017 10:24:00 +0200
Subject: Use assert_almost_equal instead of assert_equal in test_twod_numpy
Closes: #860620
---
spectral_cube/tests/test_dask.py | 2 +-
spectral_cube/tests/test_spectral_axis.py | 4 ++--
spectral_cube/tests/test_spectral_cube.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/spectral_cube/tests/test_dask.py b/spectral_cube/tests/test_dask.py
index 1edb61b..6800fef 100644
--- a/spectral_cube/tests/test_dask.py
+++ b/spectral_cube/tests/test_dask.py
@@ -112,7 +112,7 @@ def test_statistics_withnans(data_adv):
cube.rechunk((1,2,2))
stats = cube.statistics()
for key in ('min', 'max', 'sum'):
- assert stats[key] == getattr(cube, key)()
+ assert_allclose(stats[key], getattr(cube, key)())
@pytest.mark.skipif(not CASA_INSTALLED, reason='Requires CASA to be installed')
diff --git a/spectral_cube/tests/test_spectral_axis.py b/spectral_cube/tests/test_spectral_axis.py
index 5c741b7..26f66ed 100644
--- a/spectral_cube/tests/test_spectral_axis.py
+++ b/spectral_cube/tests/test_spectral_axis.py
@@ -22,13 +22,13 @@ def test_cube_wcs_freqtovel():
newwcs = convert_spectral_axis(w1, 'km/s', 'VRAD',
rest_value=w1.wcs.restfrq*u.Hz)
assert newwcs.wcs.ctype[2] == 'VRAD'
- assert newwcs.wcs.crval[2] == 305.2461585938794
+ np.testing.assert_almost_equal(newwcs.wcs.crval[2], 305.2461585938794)
assert newwcs.wcs.cunit[2] == u.Unit('km/s')
newwcs = convert_spectral_axis(w1, 'km/s', 'VRAD')
assert newwcs.wcs.ctype[2] == 'VRAD'
- assert newwcs.wcs.crval[2] == 305.2461585938794
+ np.testing.assert_almost_equal(newwcs.wcs.crval[2], 305.2461585938794)
assert newwcs.wcs.cunit[2] == u.Unit('km/s')
diff --git a/spectral_cube/tests/test_spectral_cube.py b/spectral_cube/tests/test_spectral_cube.py
index 4e73ecc..7b67438 100644
--- a/spectral_cube/tests/test_spectral_cube.py
+++ b/spectral_cube/tests/test_spectral_cube.py
@@ -1333,7 +1333,7 @@ def test_twod_numpy(func, how, axis, filename, use_dask):
# data has a redundant 1st axis
dproj = getattr(data,func)(axis=(0,axis+1)).squeeze()
assert isinstance(proj, Projection)
- np.testing.assert_equal(proj.value, dproj)
+ np.testing.assert_almost_equal(proj.value, dproj)
assert cube.unit == proj.unit
@pytest.mark.parametrize(('func','how','axis','filename'),
|