summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-01-04 19:45:29 -0700
committerGitHub <noreply@github.com>2018-01-04 19:45:29 -0700
commit10ccfe747a68d974ff16a5c0765054b816d5486f (patch)
treefc3792ab3b8f9187704072300b98764eef58ffc4 /numpy/f2py
parent9a902b775c12be99708a0a33a244ace3521855de (diff)
parent2ea0c7aa4446859d30f2e09c07fdfb5ed03cf35b (diff)
downloadnumpy-10ccfe747a68d974ff16a5c0765054b816d5486f.tar.gz
Merge pull request #10154 from eric-wieser/fixup-numerictypes
MAINT: Use a StructSequence in place of the typeinfo tuples
Diffstat (limited to 'numpy/f2py')
-rw-r--r--numpy/f2py/tests/test_array_from_pyobj.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py
index 776ec3471..cd6149c9a 100644
--- a/numpy/f2py/tests/test_array_from_pyobj.py
+++ b/numpy/f2py/tests/test_array_from_pyobj.py
@@ -141,7 +141,7 @@ class Type(object):
dtype0 = name
name = None
for n, i in typeinfo.items():
- if isinstance(i, tuple) and dtype0.type is i[-1]:
+ if not isinstance(i, type) and dtype0.type is i.type:
name = n
break
obj = cls._type_cache.get(name.upper(), None)
@@ -154,11 +154,12 @@ class Type(object):
def _init(self, name):
self.NAME = name.upper()
+ info = typeinfo[self.NAME]
self.type_num = getattr(wrap, 'NPY_' + self.NAME)
- assert_equal(self.type_num, typeinfo[self.NAME][1])
- self.dtype = typeinfo[self.NAME][-1]
- self.elsize = typeinfo[self.NAME][2] / 8
- self.dtypechar = typeinfo[self.NAME][0]
+ assert_equal(self.type_num, info.num)
+ self.dtype = info.type
+ self.elsize = info.bits / 8
+ self.dtypechar = info.char
def cast_types(self):
return [self.__class__(_m) for _m in _cast_dict[self.NAME]]
@@ -167,28 +168,28 @@ class Type(object):
return [self.__class__(_m) for _m in _type_names]
def smaller_types(self):
- bits = typeinfo[self.NAME][3]
+ bits = typeinfo[self.NAME].alignment
types = []
for name in _type_names:
- if typeinfo[name][3] < bits:
+ if typeinfo[name].alignment < bits:
types.append(Type(name))
return types
def equal_types(self):
- bits = typeinfo[self.NAME][3]
+ bits = typeinfo[self.NAME].alignment
types = []
for name in _type_names:
if name == self.NAME:
continue
- if typeinfo[name][3] == bits:
+ if typeinfo[name].alignment == bits:
types.append(Type(name))
return types
def larger_types(self):
- bits = typeinfo[self.NAME][3]
+ bits = typeinfo[self.NAME].alignment
types = []
for name in _type_names:
- if typeinfo[name][3] > bits:
+ if typeinfo[name].alignment > bits:
types.append(Type(name))
return types