diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2017-03-25 14:47:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-25 14:47:04 +0100 |
commit | ab49be1d5a6f1a7c51298a8fe46a9f43bb2bb33b (patch) | |
tree | 434f751384e02a2d386dda491527c50fed070625 /numpy/lib/tests/test_format.py | |
parent | a7ed83f6d9e5e8f5a024dfe2d42ad290d79422b1 (diff) | |
parent | 1dc20cba80660ee9f2b16e26c0d6e7f23bf9e08f (diff) | |
download | numpy-ab49be1d5a6f1a7c51298a8fe46a9f43bb2bb33b.tar.gz |
Merge pull request #8832 from eric-wieser/avoid-as-bytes
MAINT: Remove python <2.7,<3.3 string/unicode workarounds
Diffstat (limited to 'numpy/lib/tests/test_format.py')
-rw-r--r-- | numpy/lib/tests/test_format.py | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 7cc72e775..93727ef0c 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -284,7 +284,6 @@ import warnings from io import BytesIO import numpy as np -from numpy.compat import asbytes, asbytes_nested, sixu from numpy.testing import ( run_module_suite, assert_, assert_array_equal, assert_raises, raises, dec, SkipTest @@ -545,8 +544,8 @@ def test_pickle_python2_python3(): import __builtin__ xrange = __builtin__.xrange - expected = np.array([None, xrange, sixu('\u512a\u826f'), - asbytes('\xe4\xb8\x8d\xe8\x89\xaf')], + expected = np.array([None, xrange, u'\u512a\u826f', + b'\xe4\xb8\x8d\xe8\x89\xaf'], dtype=object) for fname in ['py2-objarr.npy', 'py2-objarr.npz', @@ -682,23 +681,23 @@ def test_write_version(): raise AssertionError("we should have raised a ValueError for the bad version %r" % (version,)) -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 = asbytes_nested([ - '\x92NUMPY\x01\x00', - '\x00NUMPY\x01\x00', - '\x93numpy\x01\x00', - '\x93MATLB\x01\x00', - '\x93NUMPY\x01', - '\x93NUMPY', - '', -]) +bad_version_magic = [ + b'\x93NUMPY\x01\x01', + b'\x93NUMPY\x00\x00', + b'\x93NUMPY\x00\x01', + b'\x93NUMPY\x02\x00', + b'\x93NUMPY\x02\x02', + b'\x93NUMPY\xff\xff', +] +malformed_magic = [ + b'\x92NUMPY\x01\x00', + b'\x00NUMPY\x01\x00', + b'\x93numpy\x01\x00', + b'\x93MATLB\x01\x00', + b'\x93NUMPY\x01', + b'\x93NUMPY', + b'', +] def test_read_magic(): s1 = BytesIO() @@ -778,11 +777,11 @@ def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) - s = BytesIO(asbytes('1')) + s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail - s = BytesIO(asbytes('\x01\x00')) + s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail |