[yt-svn] commit/yt: MatthewTurk: In ray tests: changing a couple assert_equals to assert_rel_equal, with

Bitbucket commits-noreply at bitbucket.org
Thu Oct 18 10:55:18 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/21333cf31d21/
changeset:   21333cf31d21
branch:      yt
user:        MatthewTurk
date:        2012-10-18 19:55:11
summary:     In ray tests: changing a couple assert_equals to assert_rel_equal, with
tolerance of 1e-14.
affected #:  2 files

diff -r 06462f53a16bbbb175a88920ed0c219aacbdc4d9 -r 21333cf31d213c5bac726e8b8f71f6c2f7520afa yt/data_objects/tests/test_rays.py
--- a/yt/data_objects/tests/test_rays.py
+++ b/yt/data_objects/tests/test_rays.py
@@ -9,7 +9,7 @@
     p2 = np.random.random(3)
 
     my_ray = pf.h.ray(p1, p2)
-    assert_equal(my_ray['dts'].sum(), 1.0)
+    assert_rel_equal(my_ray['dts'].sum(), 1.0, 14)
     ray_cells = my_ray['dts'] > 0
 
     # find cells intersected by the ray
@@ -26,6 +26,6 @@
     tout = tout.min(axis=0)
     my_cells = (tin < tout) & (tin < 1) & (tout > 0)
 
-    assert_equal(ray_cells.sum(), my_cells.sum())
-    assert_equal(my_ray['Density'][ray_cells].sum(),
-                 my_all['Density'][my_cells].sum())           
+    assert_rel_equal(ray_cells.sum(), my_cells.sum(), 14)
+    assert_rel_equal(my_ray['Density'][ray_cells].sum(),
+                     my_all['Density'][my_cells].sum(), 14)


diff -r 06462f53a16bbbb175a88920ed0c219aacbdc4d9 -r 21333cf31d213c5bac726e8b8f71f6c2f7520afa yt/testing.py
--- a/yt/testing.py
+++ b/yt/testing.py
@@ -26,7 +26,7 @@
 from yt.funcs import *
 from numpy.testing import assert_array_equal, assert_almost_equal, \
     assert_approx_equal, assert_array_almost_equal, assert_equal, \
-    assert_array_less, assert_string_equal
+    assert_array_less, assert_string_equal, assert_array_almost_equal_nulp
 
 def assert_rel_equal(a1, a2, decimels):
     return assert_almost_equal(a1/a2, 1.0, decimels)

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list