summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests/test_array_from_pyobj.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-09-22 10:53:31 -0500
committerGitHub <noreply@github.com>2018-09-22 10:53:31 -0500
commited9fa73bef4aaebb082e3d22e09ada3a312253c0 (patch)
treebb949f4f2fa2b776cdda98323eb4d65d91effddb /numpy/f2py/tests/test_array_from_pyobj.py
parent31f19645a13ee221f037ade57f13006127aa4c46 (diff)
parentcb7dca7c3c963ff14c4f58507d3672536c441921 (diff)
downloadnumpy-ed9fa73bef4aaebb082e3d22e09ada3a312253c0.tar.gz
Merge pull request #11894 from QuLogic/f2py-test-parametrize
TST: Parametrize f2py tests.
Diffstat (limited to 'numpy/f2py/tests/test_array_from_pyobj.py')
-rw-r--r--numpy/f2py/tests/test_array_from_pyobj.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py
index 67a7f010c..6b244611c 100644
--- a/numpy/f2py/tests/test_array_from_pyobj.py
+++ b/numpy/f2py/tests/test_array_from_pyobj.py
@@ -1,11 +1,12 @@
from __future__ import division, absolute_import, print_function
-import unittest
import os
import sys
import copy
import pytest
+import pytest
+
from numpy import (
array, alltrue, ndarray, zeros, dtype, intp, clongdouble
)
@@ -305,10 +306,16 @@ class TestIntent(object):
assert_(not intent.in_.is_intent('c'))
-class _test_shared_memory(object):
+class TestSharedMemory(object):
num2seq = [1, 2]
num23seq = [[1, 2, 3], [4, 5, 6]]
+ @pytest.fixture(autouse=True, scope='class', params=_type_names)
+ def setup_type(self, request):
+ request.cls.type = Type(request.param)
+ request.cls.array = lambda self, dims, intent, obj: \
+ Array(Type(request.param), dims, intent, obj)
+
def test_in_from_2seq(self):
a = self.array([2], intent.in_, self.num2seq)
assert_(not a.has_shared_memory())
@@ -574,12 +581,3 @@ class _test_shared_memory(object):
assert_(obj.flags['FORTRAN']) # obj attributes changed inplace!
assert_(not obj.flags['CONTIGUOUS'])
assert_(obj.dtype.type is self.type.dtype) # obj changed inplace!
-
-
-for t in _type_names:
- exec('''\
-class TestGen_%s(_test_shared_memory):
- def setup(self):
- self.type = Type(%r)
- array = lambda self,dims,intent,obj: Array(Type(%r),dims,intent,obj)
-''' % (t, t, t))