diff options
author | Pauli Virtanen <pav@iki.fi> | 2010-02-20 18:16:52 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2010-02-20 18:16:52 +0000 |
commit | 0e9a08cd2f5faa2b17dc6d62d4d0014386842628 (patch) | |
tree | b7dad7697d70f903da8519441a43ed4eac4f28d4 /numpy/lib | |
parent | 20121f4b65d7a5396a067c7ecd6818a7a5505639 (diff) | |
download | numpy-0e9a08cd2f5faa2b17dc6d62d4d0014386842628.tar.gz |
3K: lib: even more bytes/str fixes in format.py tests
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/tests/test_format.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index f6a6c87ce..2e6935141 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -293,6 +293,8 @@ from numpy.testing import * from numpy.lib import format +from numpy.compat import asbytes, asbytes_nested + tempdir = None @@ -489,15 +491,15 @@ def test_write_version_1_0(): raise AssertionError("we should have raised a ValueError for the bad version %r" % (version,)) -bad_version_magic = [ +bad_version_magic = asbytes_nested([ '\x93NUMPY\x01\x01', '\x93NUMPY\x00\x00', '\x93NUMPY\x00\x01', '\x93NUMPY\x02\x00', '\x93NUMPY\x02\x02', '\x93NUMPY\xff\xff', -] -malformed_magic = [ +]) +malformed_magic = asbytes_nested([ '\x92NUMPY\x01\x00', '\x00NUMPY\x01\x00', '\x93numpy\x01\x00', @@ -505,7 +507,7 @@ malformed_magic = [ '\x93NUMPY\x01', '\x93NUMPY', '', -] +]) def test_read_magic_bad_magic(): for magic in malformed_magic: @@ -536,11 +538,11 @@ def test_bad_header(): # header of length less than 2 should fail s = StringIO() assert_raises(ValueError, format.read_array_header_1_0, s) - s = StringIO('1') + s = StringIO(asbytes('1')) assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail - s = StringIO('\x01\x00') + s = StringIO(asbytes('\x01\x00')) assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail |