summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorPaul Ivanov <paul.ivanov@local>2009-12-28 20:49:52 +0000
committerPaul Ivanov <paul.ivanov@local>2009-12-28 20:49:52 +0000
commite4f233ecfedd2aafa258db2d3ae27e30604cc020 (patch)
tree6d32fbdd19b8dca00cd7cafd8df076bac55ddfd8 /numpy/testing
parent5ba01996a9ab2fdfb7c120a5afae801f854a781a (diff)
downloadnumpy-e4f233ecfedd2aafa258db2d3ae27e30604cc020.tar.gz
fixed a whole bunch of doctests
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/noseclasses.py15
-rw-r--r--numpy/testing/utils.py1
2 files changed, 16 insertions, 0 deletions
diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py
index 05d244083..aae7c5da4 100644
--- a/numpy/testing/noseclasses.py
+++ b/numpy/testing/noseclasses.py
@@ -148,6 +148,21 @@ class NumpyOutputChecker(doctest.OutputChecker):
if not ret:
if "#random" in want:
return True
+
+ # it would be useful to normalize endianness so that
+ # bigendian machines don't fail all the tests (and there are
+ # actually some bigendian examples in the doctests). Let's try
+ # making them all little endian
+ got = got.replace("'>","'<")
+ want= want.replace("'>","'<")
+
+ # try to normalize out 32 and 64 bit default int sizes
+ for sz in [4,8]:
+ got = got.replace("'<i%d'"%sz,"int")
+ want= want.replace("'<i%d'"%sz,"int")
+
+ ret = doctest.OutputChecker.check_output(self, want,
+ got, optionflags)
return ret
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 87ca389f7..abb2956a1 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -381,6 +381,7 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True):
Examples
--------
+ >>> import numpy.testing as npt
>>> npt.assert_almost_equal(2.3333333333333, 2.33333334)
>>> npt.assert_almost_equal(2.3333333333333, 2.33333334, decimal=10)
...