Skip to content

Commit 89d20b2

Browse files
committed
TEST: Upgrade to new PRNG interface and cast output when needed
1 parent b9ef70a commit 89d20b2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nibabel/gifti/tests/test_gifti.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
DATA_FILE6,
3434
)
3535

36+
rng = np.random.default_rng()
37+
3638

3739
def test_agg_data():
3840
surf_gii_img = load(get_test_data('gifti', 'ascii.gii'))
@@ -81,7 +83,7 @@ def test_gifti_image():
8183
assert gi.numDA == 0
8284

8385
# Test from numpy numeric array
84-
data = np.random.random((5,))
86+
data = rng.random(5, dtype=np.float32)
8587
da = GiftiDataArray(data)
8688
gi.add_gifti_data_array(da)
8789
assert gi.numDA == 1
@@ -98,7 +100,7 @@ def test_gifti_image():
98100

99101
# Remove one
100102
gi = GiftiImage()
101-
da = GiftiDataArray(np.zeros((5,)), intent=0)
103+
da = GiftiDataArray(np.zeros((5,), np.float32), intent=0)
102104
gi.add_gifti_data_array(da)
103105

104106
gi.remove_gifti_data_array_by_intent(3)
@@ -335,7 +337,7 @@ def test_metadata_list_interface():
335337

336338

337339
def test_gifti_label_rgba():
338-
rgba = np.random.rand(4)
340+
rgba = rng.random(4)
339341
kwargs = dict(zip(['red', 'green', 'blue', 'alpha'], rgba))
340342

341343
gl1 = GiftiLabel(**kwargs)

0 commit comments

Comments
 (0)