Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 975443d

Browse filesBrowse files
ngoldbaumcharris
authored andcommitted
TST: add new IS_64BIT constant for testing
1 parent 747bd10 commit 975443d
Copy full SHA for 975443d

File tree

Expand file treeCollapse file tree

7 files changed

+18
-19
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+18
-19
lines changed

‎numpy/_core/tests/test_array_coercion.py

Copy file name to clipboardExpand all lines: numpy/_core/tests/test_array_coercion.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
from numpy._core._rational_tests import rational
1515

1616
from numpy.testing import (
17-
assert_array_equal, assert_warns, IS_PYPY)
17+
assert_array_equal, assert_warns, IS_PYPY, IS_64BIT
18+
)
1819

1920

2021
def arraylikes():
@@ -716,8 +717,7 @@ def __array__(self, dtype=None, copy=None):
716717
arr = np.array([ArrayLike])
717718
assert arr[0] is ArrayLike
718719

719-
@pytest.mark.skipif(
720-
np.dtype(np.intp).itemsize < 8, reason="Needs 64bit platform")
720+
@pytest.mark.skipif(not IS_64BIT, reason="Needs 64bit platform")
721721
def test_too_large_array_error_paths(self):
722722
"""Test the error paths, including for memory leaks"""
723723
arr = np.array(0, dtype="uint8")

‎numpy/_core/tests/test_multiarray.py

Copy file name to clipboardExpand all lines: numpy/_core/tests/test_multiarray.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
assert_array_equal, assert_raises_regex, assert_array_almost_equal,
3131
assert_allclose, IS_PYPY, IS_WASM, IS_PYSTON, HAS_REFCOUNT,
3232
assert_array_less, runstring, temppath, suppress_warnings, break_cycles,
33-
check_support_sve, assert_array_compare,
33+
check_support_sve, assert_array_compare, IS_64BIT
3434
)
3535
from numpy.testing._private.utils import requires_memory, _no_tracing
3636
from numpy._core.tests._locales import CommaDecimalPointLocale
@@ -983,7 +983,7 @@ def test_too_big_error(self):
983983
assert_raises(ValueError, np.zeros, shape, dtype=np.int8)
984984
assert_raises(ValueError, np.ones, shape, dtype=np.int8)
985985

986-
@pytest.mark.skipif(np.dtype(np.intp).itemsize != 8,
986+
@pytest.mark.skipif(not IS_64BIT,
987987
reason="malloc may not fail on 32 bit systems")
988988
def test_malloc_fails(self):
989989
# This test is guaranteed to fail due to a too large allocation

‎numpy/_core/tests/test_regression.py

Copy file name to clipboardExpand all lines: numpy/_core/tests/test_regression.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
assert_, assert_equal, IS_PYPY, assert_almost_equal,
1515
assert_array_equal, assert_array_almost_equal, assert_raises,
1616
assert_raises_regex, assert_warns, suppress_warnings,
17-
_assert_valid_refcount, HAS_REFCOUNT, IS_PYSTON, IS_WASM
17+
_assert_valid_refcount, HAS_REFCOUNT, IS_PYSTON, IS_WASM,
18+
IS_64BIT,
1819
)
1920
from numpy.testing._private.utils import _no_tracing, requires_memory
2021
from numpy._utils import asbytes, asunicode
@@ -2265,7 +2266,7 @@ def test_void_compare_segfault(self):
22652266
def test_reshape_size_overflow(self):
22662267
# gh-7455
22672268
a = np.ones(20)[::2]
2268-
if np.dtype(np.intp).itemsize == 8:
2269+
if IS_64BIT:
22692270
# 64 bit. The following are the prime factors of 2**63 + 5,
22702271
# plus a leading 2, so when multiplied together as int64,
22712272
# the result overflows to a total size of 10.

‎numpy/f2py/tests/test_return_real.py

Copy file name to clipboardExpand all lines: numpy/f2py/tests/test_return_real.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import platform
22
import pytest
3-
import numpy as np
43

54
from numpy import array
5+
from numpy.testing import IS_64BIT
66
from . import util
77

88

@@ -53,8 +53,7 @@ def check_function(self, t, tname):
5353
"but not when run in isolation",
5454
)
5555
@pytest.mark.skipif(
56-
np.dtype(np.intp).itemsize < 8,
57-
reason="32-bit builds are buggy"
56+
not IS_64BIT, reason="32-bit builds are buggy"
5857
)
5958
class TestCReturnReal(TestReturnReal):
6059
suffix = ".pyf"

‎numpy/f2py/tests/test_semicolon_split.py

Copy file name to clipboardExpand all lines: numpy/f2py/tests/test_semicolon_split.py
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import platform
22
import pytest
3-
import numpy as np
3+
4+
from numpy.testing import IS_64BIT
45

56
from . import util
67

@@ -11,8 +12,7 @@
1112
"but not when run in isolation",
1213
)
1314
@pytest.mark.skipif(
14-
np.dtype(np.intp).itemsize < 8,
15-
reason="32-bit builds are buggy"
15+
not IS_64BIT, reason="32-bit builds are buggy"
1616
)
1717
class TestMultiline(util.F2PyTest):
1818
suffix = ".pyf"
@@ -44,8 +44,7 @@ def test_multiline(self):
4444
"but not when run in isolation",
4545
)
4646
@pytest.mark.skipif(
47-
np.dtype(np.intp).itemsize < 8,
48-
reason="32-bit builds are buggy"
47+
not IS_64BIT, reason="32-bit builds are buggy"
4948
)
5049
@pytest.mark.slow
5150
class TestCallstatement(util.F2PyTest):

‎numpy/lib/tests/test_format.py

Copy file name to clipboardExpand all lines: numpy/lib/tests/test_format.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
import numpy as np
284284
from numpy.testing import (
285285
assert_, assert_array_equal, assert_raises, assert_raises_regex,
286-
assert_warns, IS_PYPY, IS_WASM
286+
assert_warns, IS_PYPY, IS_WASM, IS_64BIT
287287
)
288288
from numpy.testing._private.utils import requires_memory
289289
from numpy.lib import format
@@ -927,8 +927,7 @@ def test_large_file_support(tmpdir):
927927

928928

929929
@pytest.mark.skipif(IS_PYPY, reason="flaky on PyPy")
930-
@pytest.mark.skipif(np.dtype(np.intp).itemsize < 8,
931-
reason="test requires 64-bit system")
930+
@pytest.mark.skipif(not IS_64BIT, reason="test requires 64-bit system")
932931
@pytest.mark.slow
933932
@requires_memory(free_bytes=2 * 2**30)
934933
def test_large_archive(tmpdir):

‎numpy/testing/_private/utils.py

Copy file name to clipboardExpand all lines: numpy/testing/_private/utils.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
'HAS_REFCOUNT', "IS_WASM", 'suppress_warnings', 'assert_array_compare',
4747
'assert_no_gc_cycles', 'break_cycles', 'HAS_LAPACK64', 'IS_PYSTON',
4848
'IS_MUSL', 'check_support_sve', 'NOGIL_BUILD',
49-
'IS_EDITABLE', 'IS_INSTALLED', 'NUMPY_ROOT', 'run_threaded',
49+
'IS_EDITABLE', 'IS_INSTALLED', 'NUMPY_ROOT', 'run_threaded', 'IS_64BIT',
5050
]
5151

5252

@@ -105,6 +105,7 @@ class KnownFailureException(Exception):
105105
IS_MUSL = True
106106

107107
NOGIL_BUILD = bool(sysconfig.get_config_var("Py_GIL_DISABLED"))
108+
IS_64BIT = np.dtype(np.intp).itemsize == 8
108109

109110
def assert_(val, msg=''):
110111
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.