Skip to content

Commit

Permalink
Refactor to prevent warnings from test_numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-brett committed Jun 18, 2024
1 parent c18d255 commit 5387e12
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nipy/labs/bindings/tests/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_copy_vector_contiguous():
x = (1000*np.random.rand(int(1e6))).astype('int32')
_test_copy_vector(x)


def test_copy_vector_strided():
x0 = (1000*np.random.rand(int(2e6))).astype('int32')
x = x0[::2]
Expand All @@ -93,18 +94,22 @@ def _test_pass_vector(x):
assert_array_equal(y, x)


def _rs1():
return random_shape(1)[0]


def test_pass_vector():
x = np.random.rand(int(random_shape(1)))-.5
x = np.random.rand(_rs1()) - .5
_test_pass_vector(x)


def test_pass_vector_int32():
x = (1000*(np.random.rand(int(random_shape(1)))-.5)).astype('int32')
x = (1000*(np.random.rand(_rs1()) - .5)).astype('int32')
_test_pass_vector(x)


def test_pass_vector_uint8():
x = (256*(np.random.rand(int(random_shape(1))))).astype('uint8')
x = (256*(np.random.rand(_rs1()))).astype('uint8')
_test_pass_vector(x)


Expand Down

0 comments on commit 5387e12

Please sign in to comment.