diff options
-rw-r--r-- | numpy/core/tests/test_machar.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 2 | ||||
-rw-r--r-- | numpy/random/_bounded_integers.pyx.in | 3 | ||||
-rw-r--r-- | numpy/testing/tests/test_utils.py | 6 |
4 files changed, 6 insertions, 7 deletions
diff --git a/numpy/core/tests/test_machar.py b/numpy/core/tests/test_machar.py index ab8800c09..64a0ffa3d 100644 --- a/numpy/core/tests/test_machar.py +++ b/numpy/core/tests/test_machar.py @@ -16,7 +16,7 @@ class TestMachAr(object): # underflow try: hiprec = ntypes.float96 - MachAr(lambda v:array([v], hiprec)) + MachAr(lambda v: array(v, hiprec)) except AttributeError: # Fixme, this needs to raise a 'skip' exception. "Skipping test: no ntypes.float96 available on this platform." diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index ae4e89d5b..d801dbf91 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -7564,8 +7564,8 @@ class TestConversion(object): # gh-9972 means that these aren't always the same int_funcs = (int, lambda x: x.__int__()) for int_func in int_funcs: + assert_equal(int_func(np.array(0)), 0) assert_equal(int_func(np.array([1])), 1) - assert_equal(int_func(np.array([0])), 0) assert_equal(int_func(np.array([[42]])), 42) assert_raises(TypeError, int_func, np.array([1, 2])) diff --git a/numpy/random/_bounded_integers.pyx.in b/numpy/random/_bounded_integers.pyx.in index 7e19471e4..9e639b53b 100644 --- a/numpy/random/_bounded_integers.pyx.in +++ b/numpy/random/_bounded_integers.pyx.in @@ -314,8 +314,7 @@ cdef object _rand_{{nptype}}(object low, object high, object size, high_arr = <np.ndarray>np.array(high, copy=False) low_ndim = np.PyArray_NDIM(low_arr) high_ndim = np.PyArray_NDIM(high_arr) - if ((low_ndim == 0 or (low_ndim == 1 and low_arr.size == 1 and size is not None)) and - (high_ndim == 0 or (high_ndim == 1 and high_arr.size == 1 and size is not None))): + if low_ndim == 0 and high_ndim == 0: low = int(low_arr) high = int(high_arr) # Subtract 1 since internal generator produces on closed interval [low, high] diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 44f93a693..d14d4090c 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -608,9 +608,9 @@ class TestApproxEqual(object): def setup(self): self._assert_func = assert_approx_equal - def test_simple_arrays(self): - x = np.array([1234.22]) - y = np.array([1234.23]) + def test_simple_0d_arrays(self): + x = np.array(1234.22) + y = np.array(1234.23) self._assert_func(x, y, significant=5) self._assert_func(x, y, significant=6) |