diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-12-06 22:57:52 -0800 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-12-06 22:57:52 -0800 |
commit | 4b613a2bcc419939c80bf6a848f5ad15714b6098 (patch) | |
tree | 90384216f2f21b094a956fd6354e0d2ea727e531 /numpy/f2py | |
parent | d4d9e9589efb352b40d25422d9f9b9b01e189fba (diff) | |
download | python-numpy-4b613a2bcc419939c80bf6a848f5ad15714b6098.tar.gz python-numpy-4b613a2bcc419939c80bf6a848f5ad15714b6098.tar.bz2 python-numpy-4b613a2bcc419939c80bf6a848f5ad15714b6098.zip |
MAINT: Look up typeinfo properties by name, not by index
Diffstat (limited to 'numpy/f2py')
-rw-r--r-- | numpy/f2py/tests/test_array_from_pyobj.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py index 2a6d8eef5..cd6149c9a 100644 --- a/numpy/f2py/tests/test_array_from_pyobj.py +++ b/numpy/f2py/tests/test_array_from_pyobj.py @@ -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 |