From 0960eedb783fcdb2710bdcf832a807d9b28b17a3 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sat, 25 Mar 2017 10:31:40 +0000 Subject: MAINT: Remove asbytes_nested where b prefixes would suffice --- numpy/ma/tests/test_core.py | 6 +++--- numpy/ma/tests/test_mrecords.py | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'numpy/ma') diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index d82e352b0..541f8fe65 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -1757,7 +1757,7 @@ class TestFillingValues(TestCase): # Tests the behavior of fill_value during conversion # We had a tailored comment to make sure special attributes are # properly dealt with - a = array(asbytes_nested(['3', '4', '5'])) + a = array([b'3', b'4', b'5']) a._optinfo.update({'comment':"updated!"}) b = array(a, dtype=int) @@ -4279,7 +4279,7 @@ class TestMaskedFields(TestCase): assert_equal(base_c.dtype, '|S8') assert_equal(base_c._data, - asbytes_nested(['pi', 'two', 'three', 'four', 'five'])) + [b'pi', b'two', b'three', b'four', b'five']) def test_set_record_slice(self): base = self.data['base'] @@ -4294,7 +4294,7 @@ class TestMaskedFields(TestCase): assert_equal(base_c.dtype, '|S8') assert_equal(base_c._data, - asbytes_nested(['pi', 'pi', 'pi', 'four', 'five'])) + [b'pi', b'pi', b'pi', b'four', b'five']) def test_mask_element(self): "Check record access" diff --git a/numpy/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py index 6e830b5b2..785733400 100644 --- a/numpy/ma/tests/test_mrecords.py +++ b/numpy/ma/tests/test_mrecords.py @@ -13,7 +13,6 @@ import pickle import numpy as np import numpy.ma as ma from numpy import recarray -from numpy.compat import asbytes_nested from numpy.ma import masked, nomask from numpy.testing import TestCase, run_module_suite, temppath from numpy.core.records import ( @@ -39,7 +38,7 @@ class TestMRecords(TestCase): # Generic setup ilist = [1, 2, 3, 4, 5] flist = [1.1, 2.2, 3.3, 4.4, 5.5] - slist = asbytes_nested(['one', 'two', 'three', 'four', 'five']) + slist = [b'one', b'two', b'three', b'four', b'five'] ddtype = [('a', int), ('b', float), ('c', '|S8')] mask = [0, 1, 0, 0, 1] self.base = ma.array(list(zip(ilist, flist, slist)), @@ -233,7 +232,7 @@ class TestMRecords(TestCase): assert_equal(mbase.b._data, [5., 5., 3.3, 4.4, 5.5]) assert_equal(mbase.b._mask, [0, 0, 0, 0, 1]) assert_equal(mbase.c._data, - asbytes_nested(['5', '5', 'three', 'four', 'five'])) + [b'5', b'5', b'three', b'four', b'five']) assert_equal(mbase.b._mask, [0, 0, 0, 0, 1]) mbase = base.view(mrecarray).copy() @@ -243,7 +242,7 @@ class TestMRecords(TestCase): assert_equal(mbase.b._data, [1.1, 2.2, 3.3, 4.4, 5.5]) assert_equal(mbase.b._mask, [1, 1, 0, 0, 1]) assert_equal(mbase.c._data, - asbytes_nested(['one', 'two', 'three', 'four', 'five'])) + [b'one', b'two', b'three', b'four', b'five']) assert_equal(mbase.b._mask, [1, 1, 0, 0, 1]) def test_setslices_hardmask(self): @@ -256,7 +255,7 @@ class TestMRecords(TestCase): assert_equal(mbase.a._data, [1, 2, 3, 5, 5]) assert_equal(mbase.b._data, [1.1, 2.2, 3.3, 5, 5.5]) assert_equal(mbase.c._data, - asbytes_nested(['one', 'two', 'three', '5', 'five'])) + [b'one', b'two', b'three', b'5', b'five']) assert_equal(mbase.a._mask, [0, 1, 0, 0, 1]) assert_equal(mbase.b._mask, mbase.a._mask) assert_equal(mbase.b._mask, mbase.c._mask) -- cgit v1.2.1