diff options
| author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2022-01-07 10:24:49 -0500 |
|---|---|---|
| committer | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2022-01-08 17:44:29 -0500 |
| commit | b375f4eace5636d87fb6e09de23e8b2cb5259a1e (patch) | |
| tree | d9b089b5f01d94f65da917e7b05bcf27d0173497 /numpy/ma | |
| parent | f4a3e07877eb258f69a7d65d8a3b7e8d96e1aacd (diff) | |
| download | numpy-b375f4eace5636d87fb6e09de23e8b2cb5259a1e.tar.gz | |
ENH: Let ndarray.__array_finalize__ be callable.
This helps subclasses, who can now do super() in their own
implementation.
Diffstat (limited to 'numpy/ma')
| -rw-r--r-- | numpy/ma/tests/test_subclassing.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py index 83a9b2f51..3491cef7f 100644 --- a/numpy/ma/tests/test_subclassing.py +++ b/numpy/ma/tests/test_subclassing.py @@ -28,8 +28,7 @@ class SubArray(np.ndarray): return x def __array_finalize__(self, obj): - if callable(getattr(super(), '__array_finalize__', None)): - super().__array_finalize__(obj) + super().__array_finalize__(obj) self.info = getattr(obj, 'info', {}).copy() return @@ -315,7 +314,7 @@ class TestSubclassing: assert_startswith(repr(mx), 'masked_array') xsub = SubArray(x) mxsub = masked_array(xsub, mask=[True, False, True, False, False]) - assert_startswith(repr(mxsub), + assert_startswith(repr(mxsub), f'masked_{SubArray.__name__}(data=[--, 1, --, 3, 4]') def test_subclass_str(self): |
