diff options
-rw-r--r-- | numpy/core/numerictypes.py | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_numerictypes.py | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 136081412..e7e7e5509 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -751,14 +751,16 @@ def issubdtype(arg1, arg2): False """ + if not issubclass_(arg1, generic): + arg1 = dtype(arg1).type if issubclass_(arg2, generic): - return issubclass(dtype(arg1).type, arg2) + return issubclass(arg1, arg2) mro = dtype(arg2).type.mro() if len(mro) > 1: val = mro[1] else: val = mro[0] - return issubclass(dtype(arg1).type, val) + return issubclass(arg1, val) # This dictionary allows look up based on any alias for an array data-type diff --git a/numpy/core/tests/test_numerictypes.py b/numpy/core/tests/test_numerictypes.py index f912e3944..977e4ce40 100644 --- a/numpy/core/tests/test_numerictypes.py +++ b/numpy/core/tests/test_numerictypes.py @@ -377,5 +377,12 @@ class TestMultipleFields(object): res = self.ary[['f0', 'f2']].tolist() assert_(res == [(1, 3), (5, 7)]) + +class TestIsSubDType(object): + def test_both_abstract(self): + assert_(np.issubdtype(np.floating, np.inexact)) + assert_(not np.issubdtype(np.inexact, np.floating)) + + if __name__ == "__main__": run_module_suite() |