summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>2017-02-10 19:20:33 +0100
committerJoerg Behrmann <behrmann@physik.fu-berlin.de>2017-02-10 23:14:11 +0100
commitbb1c471a299c0118d890988f4bfb7df8eca6595d (patch)
treec637dff1c1928c43f3913fbafec3e88cbae5bd44 /numpy/lib/tests
parent1b877254af0850d025cdc5d07b3fcaa1614dbe4b (diff)
downloadnumpy-bb1c471a299c0118d890988f4bfb7df8eca6595d.tar.gz
BUG: Make iscomplexobj compatible with custom dtypes again
This change makes iscomplexobj compatible with custom array types using custom dtypes, that are not fully compatible to Numpys dtypes, which can nevertheless be coerced to a numpy array with asarray again, as has been the behaviour before PR #7936. Fixes #8601
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_type_check.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py
index 93a4da97a..4523e3f24 100644
--- a/numpy/lib/tests/test_type_check.py
+++ b/numpy/lib/tests/test_type_check.py
@@ -183,6 +183,15 @@ class TestIscomplexobj(TestCase):
dummy = DummyPd()
assert_(iscomplexobj(dummy))
+ def test_custom_dtype_duck(self):
+ class MyArray(list):
+ @property
+ def dtype(self):
+ return complex
+
+ a = MyArray([1+0j, 2+0j, 3+0j])
+ assert_(iscomplexobj(a))
+
class TestIsrealobj(TestCase):
def test_basic(self):