Skip to content

Commit 4517378

Browse files
authored
Merge pull request numpy#26187 from plctlab/test_machine_riscv64
TST: Use platform.machine() for improved portability on riscv64
2 parents 3c9141b + 55abe41 commit 4517378

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

numpy/_core/tests/test_numeric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def setup_method(self):
798798
# Propagation of the RISC-V Unprivileged ISA for more details.
799799
# We disable the float32 sign test on riscv64 for -np.nan as the sign
800800
# of the NaN will be lost when it's converted to a float32.
801-
if platform.processor() != 'riscv64':
801+
if platform.machine() != 'riscv64':
802802
self.signf[3::6][self.ef[3::6]] = -np.nan
803803
self.signd[3::6][self.ed[3::6]] = -np.nan
804804
self.signf[4::6][self.ef[4::6]] = -0.

numpy/_core/tests/test_umath.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ def test_fpclass(self, stride):
18441844
assert_equal(np.isnan(arr_f64[::stride]), nan[::stride])
18451845
assert_equal(np.isinf(arr_f32[::stride]), inf[::stride])
18461846
assert_equal(np.isinf(arr_f64[::stride]), inf[::stride])
1847-
if platform.processor() == 'riscv64':
1847+
if platform.machine() == 'riscv64':
18481848
# On RISC-V, many operations that produce NaNs, such as converting
18491849
# a -NaN from f64 to f32, return a canonical NaN. The canonical
18501850
# NaNs are always positive. See section 11.3 NaN Generation and
@@ -1881,7 +1881,7 @@ def test_fp_noncontiguous(self, dtype):
18811881
ncontig_out = out[1::3]
18821882
contig_in = np.array(ncontig_in)
18831883

1884-
if platform.processor() == 'riscv64':
1884+
if platform.machine() == 'riscv64':
18851885
# Disable the -np.nan signbit tests on riscv64. See comments in
18861886
# test_fpclass for more details.
18871887
data_rv = np.copy(data)
@@ -1920,7 +1920,7 @@ def test_fp_noncontiguous(self, dtype):
19201920
finite_split = np.array(np.array_split(finite, 2))
19211921
assert_equal(np.isnan(data_split), nan_split)
19221922
assert_equal(np.isinf(data_split), inf_split)
1923-
if platform.processor() == 'riscv64':
1923+
if platform.machine() == 'riscv64':
19241924
data_split_rv = np.array(np.array_split(data_rv, 2))
19251925
assert_equal(np.signbit(data_split_rv), sign_split)
19261926
else:

0 commit comments

Comments
 (0)