diff options
author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2018-05-27 13:15:16 -0400 |
---|---|---|
committer | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2018-06-04 09:37:02 -0400 |
commit | 3ad49aaaf497c6daadb9b66f295f58a315476e01 (patch) | |
tree | 6e0908fdcdb3e7c4130fb932119a83fb2f8c501c /numpy/lib | |
parent | 5718b3306303b4899c017641a9282714dcf8c9b8 (diff) | |
download | numpy-3ad49aaaf497c6daadb9b66f295f58a315476e01.tar.gz |
MAINT: clean up assert_array_compare a bit further.
This brought to light two bugs in tests, which are fixed here, viz.,
that a sample ndarray subclass that tested propagation of an added
parameter was incomplete, in that in propagating the parameter in
__array_wrap__ it assumed it was there on self, but that assumption
could be broken when a view of self was taken (as is done by
x[~flagged] in the test routine), since there was no
__array_finalize__ defined.
The other subclass bug counted, incorrectly, on only needing to provide
one type of comparison, the __lt__ being explicitly tested. But flags
are compared with __eq__ and those flags will have the same subclass.
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/tests/test_ufunclike.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py index ad006fe17..5604b3744 100644 --- a/numpy/lib/tests/test_ufunclike.py +++ b/numpy/lib/tests/test_ufunclike.py @@ -55,6 +55,10 @@ class TestUfunclike(object): obj.metadata = self.metadata return obj + def __array_finalize__(self, obj): + self.metadata = getattr(obj, 'metadata', None) + return self + a = nx.array([1.1, -1.1]) m = MyArray(a, metadata='foo') f = ufl.fix(m) |