diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-06-13 13:19:12 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-06-13 13:19:12 -0600 |
commit | df148e1b6327ca699b8b56f51f34dc871551da8b (patch) | |
tree | 181f814ba3a1db237c55c539f5779f54e89d1153 /numpy | |
parent | c65a7518537a6ad53146c6479dd10de28311460e (diff) | |
download | numpy-df148e1b6327ca699b8b56f51f34dc871551da8b.tar.gz |
BUG: Fix test_void_dtype_equality_failures for Python 3.
The NotArray test class needs to define a `__ne__` method, otherwise the
inherited Python 3 method will call `__eq__`, resulting in two rather
than one DeprecationWarning.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_deprecations.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index 02dafb6de..216b23101 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -75,6 +75,7 @@ class _DeprecationTestCase(object): function(*args, **kwargs) except (Exception if function_fails else tuple()): pass + # just in case, clear the registry num_found = 0 for warning in self.log: @@ -447,6 +448,10 @@ class TestComparisonDeprecations(_DeprecationTestCase): def __array__(self): raise TypeError + # Needed so Python 3 does not raise DeprecationWarning twice. + def __ne__(self, other): + return NotImplemented + self.assert_deprecated(lambda: np.arange(2) == NotArray()) self.assert_deprecated(lambda: np.arange(2) != NotArray()) |