diff options
author | David Cournapeau <cournape@gmail.com> | 2009-03-09 09:40:53 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-03-09 09:40:53 +0000 |
commit | d4722fad0baee09e07f8f752d1be83146a6da4df (patch) | |
tree | 8e2235021b9ebcee4b8a870fe1eb02b299e88d33 /numpy/lib/tests/test_io.py | |
parent | 03c47e45987edf002f4094d3d39f4a1e3eff01f0 (diff) | |
download | numpy-d4722fad0baee09e07f8f752d1be83146a6da4df.tar.gz |
Do not hardcode string for savetxt testing, as the exact representation depends on the platform.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r-- | numpy/lib/tests/test_io.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 076f20e5e..a7796d022 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -122,15 +122,16 @@ class TestSavezLoad(RoundtripTest, TestCase): class TestSaveTxt(TestCase): - @np.testing.dec.knownfailureif(sys.platform=='win32', "Fail on Win32") + #@np.testing.dec.knownfailureif(sys.platform=='win32', "Fail on Win32") def test_array(self): a =np.array([[1, 2], [3, 4]], float) + fmt = "%.18e" c = StringIO.StringIO() - np.savetxt(c, a) + np.savetxt(c, a, fmt=fmt) c.seek(0) - assert(c.readlines() == - ['1.000000000000000000e+00 2.000000000000000000e+00\n', - '3.000000000000000000e+00 4.000000000000000000e+00\n']) + assert_equal(c.readlines(), + [(fmt + ' ' + fmt + '\n') % (1, 2), + (fmt + ' ' + fmt + '\n') % (3, 4)]) a =np.array([[1, 2], [3, 4]], int) c = StringIO.StringIO() |