Skip to content

Commit

Permalink
Merge pull request numpy#26187 from plctlab/test_machine_riscv64
Browse files Browse the repository at this point in the history
TST: Use platform.machine() for improved portability on riscv64
  • Loading branch information
mattip authored Apr 1, 2024
2 parents 3c9141b + 55abe41 commit 4517378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion numpy/_core/tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ def setup_method(self):
# Propagation of the RISC-V Unprivileged ISA for more details.
# We disable the float32 sign test on riscv64 for -np.nan as the sign
# of the NaN will be lost when it's converted to a float32.
if platform.processor() != 'riscv64':
if platform.machine() != 'riscv64':
self.signf[3::6][self.ef[3::6]] = -np.nan
self.signd[3::6][self.ed[3::6]] = -np.nan
self.signf[4::6][self.ef[4::6]] = -0.
Expand Down
6 changes: 3 additions & 3 deletions numpy/_core/tests/test_umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ def test_fpclass(self, stride):
assert_equal(np.isnan(arr_f64[::stride]), nan[::stride])
assert_equal(np.isinf(arr_f32[::stride]), inf[::stride])
assert_equal(np.isinf(arr_f64[::stride]), inf[::stride])
if platform.processor() == 'riscv64':
if platform.machine() == 'riscv64':
# On RISC-V, many operations that produce NaNs, such as converting
# a -NaN from f64 to f32, return a canonical NaN. The canonical
# NaNs are always positive. See section 11.3 NaN Generation and
Expand Down Expand Up @@ -1881,7 +1881,7 @@ def test_fp_noncontiguous(self, dtype):
ncontig_out = out[1::3]
contig_in = np.array(ncontig_in)

if platform.processor() == 'riscv64':
if platform.machine() == 'riscv64':
# Disable the -np.nan signbit tests on riscv64. See comments in
# test_fpclass for more details.
data_rv = np.copy(data)
Expand Down Expand Up @@ -1920,7 +1920,7 @@ def test_fp_noncontiguous(self, dtype):
finite_split = np.array(np.array_split(finite, 2))
assert_equal(np.isnan(data_split), nan_split)
assert_equal(np.isinf(data_split), inf_split)
if platform.processor() == 'riscv64':
if platform.machine() == 'riscv64':
data_split_rv = np.array(np.array_split(data_rv, 2))
assert_equal(np.signbit(data_split_rv), sign_split)
else:
Expand Down

0 comments on commit 4517378

Please sign in to comment.