summaryrefslogtreecommitdiff
path: root/numpy/ma/tests/test_subclassing.py
Commit message (Collapse)AuthorAgeFilesLines
* TST: Add a test for slots and NDArrayOperatorsMixin subclassingMark Harfouche2023-01-271-0/+10
|
* TST,MAINT: Replace most `setup` with `setup_method` (also teardown)Sebastian Berg2022-10-271-2/+2
| | | | | | | | In some cases, the replacement is clearly not what is intended, in those (where setup was called explicitly), I mostly renamed `setup` to `_setup`. The `test_ccompile_opt` is a bit confusing, so left it right now (this will probably fail)
* TST: Adding a test that MaskedArrays respect ufunc deferral heirarchyGreg Lucas2022-07-131-0/+64
| | | | | This test makes sure that a MaskedArray defers properly to another class if it doesn't know how to handle it. See #15200.
* Revert "ENH: Adding __array_ufunc__ capability to MaskedArrays"Matti Picus2022-07-091-59/+0
|
* TST: Adding a test that MaskedArrays respect ufunc deferral heirarchyGreg Lucas2022-06-291-0/+59
| | | | | This test makes sure that a MaskedArray defers properly to another class if it doesn't know how to handle it. See #15200.
* ENH: Let ndarray.__array_finalize__ be callable.Marten van Kerkwijk2022-01-081-3/+2
| | | | | This helps subclasses, who can now do super() in their own implementation.
* REV: Add MaskedArray creation from non nd-array back in (#20386)Greg Lucas2021-11-161-0/+42
| | | | | | | | | | | | * REV: Add MaskedArray creation from non nd-array back in This code path was removed in beacb39. This adds back in the MaskedArray portion of that commit. A test with a Quantity-like (non inherited, but still acts like a MaskedArray) class for this case. * Update numpy/ma/core.py Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* MAINT: use super() as described by PEP 3135Mike Taves2021-03-191-10/+8
|
* MAINT: Conversion of some strings to fstrings, part III (#17623)jakobjakobson132020-10-251-4/+4
| | | | | | | | | | | | | | | | | | | | * 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: Clean-up 'next = __next__' used for Python 2 compatibilityMike Taves2020-04-011-2/+0
|
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-051-2/+2
| | | | | | | 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-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* MAINT: Convert property to @propertyAlex Watt2019-02-241-2/+2
|
* MAINT: move all masked array matrix tests to matrixlib.Marten van Kerkwijk2018-04-271-33/+12
| | | | | | 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-061-6/+1
| | | | | That function is nose specific and has not worked since `__init__` files were added to the tests directories.
* TST: Switch to using pytest markersCharles Harris2018-04-041-1/+1
| | | | | | | | | | | Use standard pytest markers everywhere in the numpy tests. At this point there should be no nose dependency. However, nose is required to test the legacy decorators if so desired. At this point, numpy test cannot be run in the way with runtests, rather installed numpy can be tested with `pytest --pyargs numpy` as long as that is not run from the repo. Run it from the tools directory or some such.
* ENH: Improve MaskedArray.__repr__Eric Wieser2017-11-201-1/+1
| | | | | | | * Commas are now used within data and mask * dtypes are shown for float32, int8 etc, where they previously weren't * Wrapped fields are now correctly indented * Spaces removed around = to match PEP8
* TST: Improve assertion error messagesEric Wieser2017-11-201-5/+8
|
* TST: Remove unittest dependencies in numpy/ma/tests.Charles Harris2017-07-241-56/+56
|
* BUG: Correctly distinguish between 0d arrays and scalarsEric Wieser2017-04-191-2/+18
| | | | This fixes #8684
* ENH: Deprecation warnings for `/` integer division when running python -3saurabh2016-11-011-1/+1
| | | | | | When python is invoked with switch -3, it emits waring "classic int division" for strict integer divisions. The same behavior is now implemented to numpy with this fix
* Revert part of #3907 which incorrectly propogated MaskedArray info.Marten van Kerkwijk2016-02-201-0/+20
|
* STY,MAINT: Run pyflakes and pep8 on numpy/ma/tests/*.Charles Harris2015-07-251-8/+7
| | | | | | | | Also fix "*" imports. The formatting of test arrays is not fixed for multiple spaces following "," and other violations that are common in tests. To be precise, E241 and E201 are added to the errors that are excluded.
* BUG Allow subclasses in MaskedArray ufuncs -- for non-ndarray _dataMarten van Kerkwijk2015-06-161-10/+30
|
* ENH: Let MaskedArray getter, setter respect baseclass overridesMarten van Kerkwijk2015-04-221-5/+88
|
* ENH: Ensure that repr and str work for MaskedArray non-ndarray basesMarten van Kerkwijk2014-04-041-0/+43
| | | | | | | | For repr, use the name of the base class in output as "masked_<name>" (with name=array for ndarray to match the previous implementation). For str, insert masked_print_option in an ndarray view of the object array that is created for string output, to avoid calling __setitem__ in the base class. Add tests to ensure this works.
* Convert docstrings to comments for nose; PEP8 cleanup (some tests activated)Marten van Kerkwijk2013-10-121-11/+23
|
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-24/+24
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
* MAINT: Use np.errstate context manager.Charles Harris2013-07-111-4/+1
| | | | | | | | | | | | | Now that Python < 2.6 is no longer supported we can use the errstate context manager in places where constructs like ``` old = seterr(invalid='ignore') try: blah finally: seterr(**old) ``` were used.
* TST: fix some function name conflictsJulian Taylor2013-06-051-1/+1
| | | | enables a few extra tests
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 2to3: Use absolute imports.Charles Harris2013-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172
* 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+3
| | | | | | | | This should be harmless, as we already are division clean. However, placement of this import takes some care. In the future a script can be used to append new features without worry, at least until such time as it exceeds a single line. Having that ability will make it easier to deal with absolute imports and printing updates.
* TST: fix two divide-by-zero test warnings.rgommers2011-03-111-2/+6
|
* DEP: Fix deprecation warnings in Python 3.1. The warnings come from the unittestCharles Harris2010-02-201-26/+26
| | | | | | | | | module. The fix should be good for Python >= 2.4 and used the following sed script: s/\<failUnless\>/assertTrue/g s/\<failIf\>/assertFalse/g s/\<failUnlessEqual\>/assertEqual/g s/\<failUnlessRaises\>/assertRaises/g
* * getdata : prevent unnecessary copies (thx to Eric Firing)pierregm2009-05-131-3/+25
| | | | | * _Domained/MaskedUnary/BinaryOperations: optimization by preventing the use of np.where and the calculation of domain. Here's the catch: we're basically cheating. We force np.seterr(divide='ignore',invalid='ignore') before computing the results, then mask the invalid values (if any) and reset the corresponding entries in .data to the input. Finally, we reset the error status. This playing around with the error status may (or may not) fail in multi-thread. It's still faaar faster than computing the domain (especially _DomainSafeDivide) when the inputs are large...
* ran reindentJarrod Millman2008-12-311-2/+0
|
* core : * fixed make_mask_descr to recognize subdtypes pierregm2008-10-181-21/+1
| | | | | | | | | : * fixed some corner cases of view mrecords : * fixed view : * got rid of _fieldmask for _mask : * WARNING: setting ._mask no longer calls __setmask__ : BE CAREFUL. : * prevent setting ._mask directly, as it screws up things: use .mask instead test_subclassing : * clean up
* replaced assert with self.failUnlesspierregm2008-09-291-30/+30
|
* Removed unused imports.Alan McIntyre2008-09-091-2/+0
|
* Standardize NumPy import as "import numpy as np".Alan McIntyre2008-07-221-13/+13
|
* Restore old test framework classes.Alan McIntyre2008-06-211-1/+1
| | | | | | | | | | | Added numpy.testing.run_module_suite to simplify "if __name__ == '__main__'" boilerplate code in test modules. Removed numpy/testing/pkgtester.py since it just consisted of an import statement after porting SciPy r4424. Allow numpy.*.test() to accept the old keyword arguments (but issue a deprecation warning when old arguments are seen). numpy.*.test() returns a test result object as before. Fixed typo in distutils doc.
* Switched to use nose to run tests. Added test and bench functions to all ↵Alan McIntyre2008-06-171-15/+11
| | | | modules.
* core : clean up update_frompierregm2008-05-011-1/+1
|
* Move ma to numpy root. Fix unit tests. Remove references to numpy.core.ma.Stefan van der Walt2007-12-151-0/+183