diff options
author | Antony Lee <anntzer.lee@gmail.com> | 2016-04-07 01:10:11 -0700 |
---|---|---|
committer | seberg <sebastian@sipsolutions.net> | 2016-04-07 10:10:11 +0200 |
commit | bcbed877f42ed6e9b01b2125134db4b6395f1d9d (patch) | |
tree | 2e4fe5e4dde9c5ec4170272c050479991f4ab1e9 | |
parent | ac21efdd9d5d69198bc0802645826a4b1240952a (diff) | |
download | numpy-bcbed877f42ed6e9b01b2125134db4b6395f1d9d.tar.gz |
BUG: Add bytes to numpy.sctypes in Python 3.
-rw-r--r-- | doc/release/1.12.0-notes.rst | 6 | ||||
-rw-r--r-- | numpy/core/numerictypes.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 8 |
3 files changed, 11 insertions, 5 deletions
diff --git a/doc/release/1.12.0-notes.rst b/doc/release/1.12.0-notes.rst index 084f6bac5..eaf0ffd70 100644 --- a/doc/release/1.12.0-notes.rst +++ b/doc/release/1.12.0-notes.rst @@ -192,6 +192,12 @@ from these operations. Also, reduction of a memmap (e.g. ``.sum(axis=None``) now returns a numpy scalar instead of a 0d memmap. +numpy.sctypes now includes bytes on Python3 too +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, it included str (bytes) and unicode on Python2, but only str +(unicode) on Python3. + + Deprecations ============ diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 1b6551e6c..600d5af33 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -438,7 +438,7 @@ sctypes = {'int': [], 'uint':[], 'float':[], 'complex':[], - 'others':[bool, object, str, unicode, void]} + 'others':[bool, object, bytes, unicode, void]} def _add_array_type(typename, bits): try: diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index deb1f66eb..8cd28f88f 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -3479,11 +3479,11 @@ class TestCompress(TestCase): class TestPutmask(object): def tst_basic(self, x, T, mask, val): np.putmask(x, mask, val) - assert_(np.all(x[mask] == T(val))) - assert_(x.dtype == T) + assert_equal(x[mask], T(val)) + assert_equal(x.dtype, T) def test_ip_types(self): - unchecked_types = [str, unicode, np.void, object] + unchecked_types = [bytes, unicode, np.void, object] x = np.random.random(1000)*100 mask = x < 40 @@ -3526,7 +3526,7 @@ class TestTake(object): assert_array_equal(x.take(ind, axis=0), x) def test_ip_types(self): - unchecked_types = [str, unicode, np.void, object] + unchecked_types = [bytes, unicode, np.void, object] x = np.random.random(24)*100 x.shape = 2, 3, 4 |