summaryrefslogtreecommitdiff
path: root/numpy/ma/tests
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Allow unmodified use of isclose, allclose, etc. with timedeltaSebastian Berg2021-02-041-0/+7
| | | | | | | | | | | | | | Disallowing timedelta64+float promotion (to timedelta64) in all cases (previously it was assymetric and "half allowed") meant that isclose, allclose, np.ma.allclose, and assert_arrays_almost_equal (which uses isclose), would stop work for timedelta64. Hardcoding that timedelta64 is passed on unmodified retains the old behaviour. It may make sense to deprecate or change this behaviour in the future, but for the 1.20 release, the behaviour should be as much unmodified as possible. Closes gh-18286
* MAINT: ma: Remove unused `**options` from MaskedArray `__new__` method.Warren Weckesser2020-11-081-2/+6
| | | | | | | | | | | | | | | | | | | | | | The `__new__` method of `MaskedArray` has the parameter `**options`, but it is not used. This means a mistyped parameter is silently ignored, e.g. if I mistype the `mask` parameter like this, I don't get an error: In [2]: m = np.ma.MaskedArray([1, 2, 3], maks=[0, 1, 0]) In [3]: m Out[3]: masked_array(data=[1, 2, 3], mask=False, fill_value=999999) In this PR, I simply remove `**options` from the signature of `MaskedArray.__new__`. This affected one test. That test was passing the argument `shape=(0, 1, 2)` to the constructor of a subclass of `MaskedArray`, but since any unknown keywords were silently ignored, that use of `shape` had no effect. I replaced it with the positional argument `[[[]], [[]]]`, which I believe has the effect that was originally intended with the use of the `shape` argument.
* MAINT: Conversion of some strings to fstrings, part III (#17623)jakobjakobson132020-10-253-17/+17
| | | | | | | | | | | | | | | | | | | | * Conversion of some strings to fstrings * Remove spaces * Update numpy/ma/mrecords.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * Update numpy/ma/tests/test_old_ma.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * Update numpy/ma/timer_comparison.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> Co-authored-by: Jakob <jakobjakobson13@posteo.de> Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
* MAINT: Remove old sys.version_info codeHugo2020-09-031-2/+0
|
* MAINT: Undo change of how 0-D array-likes are handled as scalarsSebastian Berg2020-07-081-0/+11
|
* DOC: Fix ``np.ma.core.doc_note`` (#16311)Takanori H2020-06-091-2/+32
| | | * fix np.ma.core.doc_note
* BUG: max/min of a masked array dtype fix (gh-15991)Rakesh Vasudevan2020-05-141-0/+42
| | | | | | | | | Fix for issue gh-15077. ma.core now checks and sets max and min values for all float and complex dtypes. This fixes the max of a masked array with a float16 or complex dtype returning inf Builds on top of gh-15086. Co-authored-by: William Jones <william.jones@physics.ox.ac.uk>
* BUG: fix AttributeError on accessing object in nested MaskedArray. (#15949)RenaRuirui2020-04-251-0/+22
| | | | | | * BUG: fix AttributeError on accessing object in nested MaskedArray Co-authored-by: Rena Xu <renaxu@Renas-MacBook-Pro.local> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: vagrant <vagrant@vagrant.vm>
* Merge pull request #15867 from eric-wieser/deprecate-tostringMatti Picus2020-04-011-2/+2
|\ | | | | DEP: Deprecate ndarray.tostring()
| * DEP: Deprecate ndarray.tostring()Eric Wieser2020-03-301-2/+2
| | | | | | | | The corresponding `array.array.tostring()` in the standard library has been deprecated in favor of `tobytes` since Python 3.1 (python/cpython@1ce3eb5c5b4830e69b21865e2d723e22749544e0).
* | MAINT: Clean-up 'next = __next__' used for Python 2 compatibilityMike Taves2020-04-011-2/+0
| |
* | BUG: Add basic __format__ for masked element to fix incorrect print (#15794)Warren Weckesser2020-03-241-0/+15
|/ | | | | | | | | | | | Fix and test conversion of masked element to string in fstring / string interpolation. See PEP 498 for string interpolation (aka fstrings) in Python 3.6 and above. Fixes #15409. Original PR gh-15410 by: Stefan Codrescu <ssmmcc1@gmail.com> Co-authored-by: Stefan Codrescu <ssmmcc1@gmail.com> Co-authored-by: Stefan <5tefan@users.noreply.github.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* MAINT: Remove Python2 workaroundsSeth Troisi2020-01-231-4/+20
|
* NEP: issue deprecation warning when creating ragged array (NEP 34)Matti Picus2020-01-211-1/+1
| | | | This implements NEP 34.
* MAINT: Remove sys.version checks in testsSeth Troisi2020-01-151-5/+0
|
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-057-43/+43
| | | | | | | Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-037-14/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* Revert "DEP: issue deprecation warning when creating ragged array (NEP 34)"revert-14794-nep-0034-implRalf Gommers2019-12-061-1/+1
|
* Merge pull request #14794 from mattip/nep-0034-implRalf Gommers2019-12-021-1/+1
|\ | | | | DEP: issue deprecation warning when creating ragged array (NEP 34)
| * DEP: issue deprecation warning when creating ragged array (NEP 34)mattip2019-10-311-1/+1
| |
* | DEP: Deprecate the axis argument to masked_rows and masked_colsEric Wieser2019-12-021-0/+13
|/ | | | | This argument isn't used, and is confusing. (Small test added by seberg)
* Merge pull request #14145 from eric-wieser/fix-14140Sebastian Berg2019-07-301-0/+7
|\ | | | | BUG: Remove the broken clip wrapper
| * BUG: Remove the broken clip wrapperEric Wieser2019-07-281-0/+7
| | | | | | | | | | | | ndarray.clip is already just a wrapper for the ufunc, so there is no need to do type-specific wrapping here any more Fixes gh-14140
* | MAINT: Replace integers in places where booleans are expectedMSeifert042019-07-013-14/+14
|/
* Merge pull request #10308 from eric-wieser/mask-attr-is-viewMatti Picus2019-05-122-9/+16
|\ | | | | API: Make MaskedArray.mask return a view, rather than the underlying mask
| * API: Make MaskedArray.mask return a view, rather than the underlying maskEric Wieser2019-05-112-9/+16
| | | | | | | | | | | | | | | | This prevents consumers from reshaping the mask in place, which breaks things As a result, `x.mask is x.mask` returns `False`, but this was already true of `x.data is x.data`. May also be related to gh-10270
* | BUG: ma.tostring should respect the order parameterPeter Bell2019-05-071-0/+4
|/
* MAINT: Convert property to @propertyAlex Watt2019-02-241-2/+2
|
* MAINT: Move pickle import to numpy.compatCharles Harris2019-02-213-3/+3
| | | | | | | The pickle module was being imported from numpy.core.numeric. It was defined there in order to use pickle5 when available in Python3 and cpickle in Python2. The numpy.compat module seems a better place for that.
* ENH: remove "Invalid value" warnings from median, percentilemattip2019-01-061-65/+42
|
* Merge pull request #11721 from eric-wieser/fix-9647Charles Harris2018-12-161-2/+2
|\ | | | | BUG: Make `arr.ctypes.data` hold onto a reference to the underlying array
| * BUG: Make `arr.ctypes.data` hold onto a reference to the underlying arrayEric Wieser2018-10-301-2/+2
| | | | | | | | | | | | | | | | We do this by going through ctypes.from_buffer, which keeps the object the buffer came from alive. A bunch of hacks are required to produce a sufficiently simple buffer for ctypes to accept. Fixes #9647
* | MAINT: Review F401,F841,F842 flake8 errors (unused variables and imports) ↵Roman Yurchak2018-12-065-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | (#12448) * Review F401,F841,F842 flake8 errors (unused variables, imports) * Review comments * More tests in test_installed_npymath_ini * Review comments
* | BUG: IndexError for empty list on structured MaskedArray.Marten van Kerkwijk2018-11-301-0/+5
| | | | | | | | | | This should give an empty result, not an error. The problem was that the empty list was interpreted as a list of strings.
* | BUG: multifield-view of MaskedArray gets bad fill_valueAllan Haldane2018-11-191-0/+11
|/ | | | Fixes #10483
* TST: Add masked array tests for '==' and '!='.Charles Harris2018-10-241-5/+145
| | | | | Cover the string and numeric types. Structured types were already covered.
* BUG: Fix MaskedArray fill_value type conversion.Charles Harris2018-10-201-1/+23
| | | | | | | Fixes the regression introduced by #10211 where the masked array fill value type was not properly converted by astype. Closes #12070.
* MAINT, TST import pickle from numpy.core.numericPierre Glaser2018-10-103-41/+48
| | | | | | | | All imports of pickle from numpy modules are now done this way: >>> from numpy.core.numeric import pickle Also, some loops on protocol numbers are added over pickle tests that were not caught from #12090
* TST: Replace calls to unittest.TestCase.fail (#11933)Roman Yurchak2018-09-121-6/+2
| | | | | | | | After the pytest migration, test classes no longer inherit from unittest.TestCase and and the fail method does not exist anymore. In all these cases, we can use assert_raises and assert_raises_regex instead
* MAINT: reformat line spacing before test methodsmattip2018-08-191-3/+0
|
* BUG: Fix test sensitive to platform byte order.Charles Harris2018-08-181-8/+3
| | | | | | | | | The TestMaskedArrayMethods.test_sort_flexible test was failing for for the subarray checks on big endian systems. That was probably due to subarrays being sorted as bytestrings. This fixes the test by simply checking that the sort does not error rather than checking the result. Closes #11716.
* Merge pull request #11299 from eric-wieser/ma-fieldless-dtypeAllan Haldane2018-08-021-0/+15
|\ | | | | BUG: Prevent crashes on 0-length structured void scalars
| * BUG: Prevent crashes on 0-length structured void scalarsEric Wieser2018-06-101-0/+15
| |
* | BUG: Undo behavior change in ma.masked_values(shrink=True)Eric Wieser2018-06-101-0/+6
|/ | | | | | This change was introduced as part of #10232 Fixes #11112
* Merge pull request #10314 from mhvk/ma-array-finalize-mask-viewEric Wieser2018-05-293-2/+18
|\ | | | | BUG: Ensure __array_finalize__ cannot back-mangle shape
| * BUG: Ensure __array_finalize__ cannot back-mangle shapeMarten H. van Kerkwijk2018-05-163-2/+18
| |
* | BUG: __copy__ and __deepcopy__ should preserve MaskedConstant (#11038)Kritika Jalan2018-05-251-0/+10
| | | | | | Fixes #11021
* | MAINT: move remaining MaskedArray matrix tests to matrixlib.Marten van Kerkwijk2018-05-221-15/+0
|/
* MAINT: move all masked array matrix tests to matrixlib.Marten van Kerkwijk2018-04-273-155/+22
| | | | | | Further progress in isolating matrix in preparation of its deprecation. There is one place left with an explicit reference to matrix (in MaskedArray.count), which is to be solved later.
* MAINT: Remove all uses of run_module_suite.Charles Harris2018-04-067-36/+7
| | | | | That function is nose specific and has not worked since `__init__` files were added to the tests directories.