summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-06-07 18:55:08 -0600
committerGitHub <noreply@github.com>2018-06-07 18:55:08 -0600
commit4b0432afef28f631f1cf36aed81b08e5dfc3991c (patch)
tree01e39c2b9f0bf55a503909b198b51777e314433d
parentbfaaf9dc55ba69a68dbda68deed88f90f32eac68 (diff)
parenta9cf7ac1917b266536fe227919021a516ece70cd (diff)
downloadnumpy-4b0432afef28f631f1cf36aed81b08e5dfc3991c.tar.gz
Merge pull request #11275 from seberg/tst-no-empty-sort
TST: Do not use empty arrays in tests (unless they are not read)
-rw-r--r--numpy/core/tests/test_multiarray.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 3bc7e92c1..77f2f3259 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -1661,12 +1661,14 @@ class TestMethods(object):
def test_void_sort(self):
# gh-8210 - previously segfaulted
for i in range(4):
- arr = np.empty(1000, 'V4')
+ rand = np.random.randint(256, size=4000, dtype=np.uint8)
+ arr = rand.view('V4')
arr[::-1].sort()
dt = np.dtype([('val', 'i4', (1,))])
for i in range(4):
- arr = np.empty(1000, dt)
+ rand = np.random.randint(256, size=4000, dtype=np.uint8)
+ arr = rand.view(dt)
arr[::-1].sort()
def test_sort_raises(self):
@@ -3345,7 +3347,7 @@ class TestBinop(object):
def __div__(self, other):
raise AssertionError('__div__ should not be called')
-
+
def __pow__(self, exp):
return SomeClass(num=self.num ** exp)
@@ -3365,7 +3367,7 @@ class TestBinop(object):
assert_equal(obj_arr ** 1, pow_for(1, obj_arr))
assert_equal(obj_arr ** -1, pow_for(-1, obj_arr))
assert_equal(obj_arr ** 2, pow_for(2, obj_arr))
-
+
class TestTemporaryElide(object):
# elision is only triggered on relatively large arrays