diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2020-08-13 17:06:27 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2020-08-13 17:06:27 +0200 |
commit | 26734efdb1c8ee269bb97acc22b587027a5a3f88 (patch) | |
tree | 45effb3e0f80816c4ffc6531975fb76946b9882a /numpy/lib/tests/test_function_base.py | |
parent | f977f575d6263cac4703d809f57fe895415993ae (diff) | |
download | numpy-26734efdb1c8ee269bb97acc22b587027a5a3f88.tar.gz |
TST: Added / updated object array-related tests
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 744034e01..ce5c358e0 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1169,9 +1169,10 @@ class TestTrimZeros: a = np.array([0, 0, 1, 0, 2, 3, 4, 0]) b = a.astype(float) c = a.astype(complex) + d = a.astype(object) def values(self): - attr_names = ('a', 'b', 'c') + attr_names = ('a', 'b', 'c', 'd') return (getattr(self, name) for name in attr_names) def test_basic(self): @@ -1207,6 +1208,22 @@ class TestTrimZeros: res = trim_zeros(arr) assert_array_equal(arr, res) + @pytest.mark.parametrize( + 'arr', + [np.array([0, 2**62, 0]), + np.array([0, 2**63, 0]), + np.array([0, 2**64, 0])] + ) + def test_overflow(self, arr): + slc = np.s_[1:2] + res = trim_zeros(arr) + assert_array_equal(res, arr[slc]) + + def test_no_trim(self): + arr = np.array([None, 1, None]) + res = trim_zeros(arr) + assert_array_equal(arr, res) + class TestExtins: |