diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-01-15 22:08:07 -0800 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-01-16 23:18:21 -0800 |
commit | 4d9a195ce25ef5039a6cc0e45f77923077254519 (patch) | |
tree | d7ca60a3ee0f03a95f57b290df84752e35110b61 | |
parent | 7f9a49b065fc02499da1bab084eb3e2c0e87b342 (diff) | |
download | numpy-4d9a195ce25ef5039a6cc0e45f77923077254519.tar.gz |
TST: enable and fix shadowed test that never ran due to duplicate names
-rw-r--r-- | numpy/core/tests/test_records.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py index e23e9c48c..f7708be03 100644 --- a/numpy/core/tests/test_records.py +++ b/numpy/core/tests/test_records.py @@ -104,7 +104,7 @@ class TestFromrecords(object): def test_recarray_repr(self): a = np.array([(1, 0.1), (2, 0.2)], - dtype=[('foo', int), ('bar', float)]) + dtype=[('foo', '<i4'), ('bar', '<f8')]) a = np.rec.array(a) assert_equal( repr(a), @@ -113,6 +113,16 @@ class TestFromrecords(object): dtype=[('foo', '<i4'), ('bar', '<f8')])""") ) + # make sure non-structured dtypes also show up as rec.array + a = np.array(np.ones(4, dtype='f8')) + assert_(repr(np.rec.array(a)).startswith('rec.array')) + + # check that the 'np.record' part of the dtype isn't shown + a = np.rec.array(np.ones(3, dtype='i4,i4')) + assert_equal(repr(a).find('numpy.record'), -1) + a = np.rec.array(np.ones(3, dtype='i4')) + assert_(repr(a).find('dtype=int32') != -1) + def test_0d_recarray_repr(self): # testing infered integer types is unpleasant due to sizeof(int) varying arr_0d = np.rec.array((np.int32(1), 2.0, np.datetime64('2003'))) @@ -214,17 +224,6 @@ class TestFromrecords(object): assert_equal(arr2.dtype.type, arr.dtype.type) assert_equal(type(arr2), type(arr)) - def test_recarray_repr(self): - # make sure non-structured dtypes also show up as rec.array - a = np.array(np.ones(4, dtype='f8')) - assert_(repr(np.rec.array(a)).startswith('rec.array')) - - # check that the 'np.record' part of the dtype isn't shown - a = np.rec.array(np.ones(3, dtype='i4,i4')) - assert_equal(repr(a).find('numpy.record'), -1) - a = np.rec.array(np.ones(3, dtype='i4')) - assert_(repr(a).find('dtype=int32') != -1) - def test_recarray_from_names(self): ra = np.rec.array([ (1, 'abc', 3.7000002861022949, 0), |