assert_(c == 3.+3j)

    @dec.slow
    def test_inline(self):
        a = numpy.complex128(1+1j)
        result = inline_tools.inline("return_val=1.0/a;",['a'])
        assert_(result == .5-.5j)


for _n in dir():
    if _n[-9:] == 'Converter':
        if msvc_exists():
            exec("class Test%sMsvc(%s):\n    compiler = 'msvc'" % (_n,_n))
        else:
            exec("class Test%sUnix(%s):\n    compiler = ''" % (_n,_n))
        if gcc_exists():
            exec("class Test%sGcc(%s):\n    compiler = 'gcc'" % (_n,_n))


def setup_test_location():
    test_dir = tempfile.mkdtemp()
    sys.path.insert(0,test_dir)
    return test_dir


test_dir = setup_test_location()


def teardown_test_location():
    import tempfile
    test_dir = os.path.join(tempfile.gettempdir(),'test_files')
Example #2
0
        test = ext_tools.ext_function('test', code, ['a'])
        mod.add_function(test)
        mod.compile(location=test_dir, compiler=self.compiler)
        exec('from ' + mod_name + ' import test')
        b = {'z': 2}
        c = test(b)
        assert_(c['hello'] == 5)


for _n in dir():
    if _n[-9:] == 'Converter':
        if msvc_exists():
            exec("class Test%sMsvc(%s):\n    compiler = 'msvc'" % (_n, _n))
        else:
            exec("class Test%sUnix(%s):\n    compiler = ''" % (_n, _n))
        if gcc_exists():
            exec("class Test%sGcc(%s):\n    compiler = 'gcc'" % (_n, _n))


def setup_location():
    test_dir = tempfile.mkdtemp()
    sys.path.insert(0, test_dir)
    return test_dir


test_dir = None


def setUpModule():
    global test_dir
    test_dir = setup_location()
Example #3
0
        c = test(b)
        assert_( c['hello'] == 5)


# for compiler in compilers:
    # for name,klass in globals().iteritems():
    #     if name[:4]=="Test" and name[-9:] == "Converter":
    #         exec("class %s%s(%s):\n    compiler = '%s'"%(name,compiler,name,compiler))
# for converter in
for _n in dir():
    if _n[-9:]=='Converter':
        if msvc_exists():
            exec "class Test%sMsvc(%s):\n    compiler = 'msvc'"%(_n,_n)
        else:
            exec "class Test%sUnix(%s):\n    compiler = ''"%(_n,_n)
        if gcc_exists():
            exec "class Test%sGcc(%s):\n    compiler = 'gcc'"%(_n,_n)

# class TestMsvcIntConverter(TestIntConverter):
#     compiler = 'msvc'
# class TestUnixIntConverter(TestIntConverter):
#     compiler = ''
# class TestGccIntConverter(TestIntConverter):
#     compiler = 'gcc'
#
# class TestMsvcFloatConverter(TestFloatConverter):
#     compiler = 'msvc'
#
# class TestMsvcFloatConverter(TestFloatConverter):
#     compiler = 'msvc'
# class TestUnixFloatConverter(TestFloatConverter):
Example #4
0
        assert_(c == 3. + 3j)

    @dec.slow
    def test_inline(self):
        a = numpy.complex128(1 + 1j)
        result = inline_tools.inline("return_val=1.0/a;", ['a'])
        assert_(result == .5 - .5j)


for _n in dir():
    if _n[-9:] == 'Converter':
        if msvc_exists():
            exec("class Test%sMsvc(%s):\n    compiler = 'msvc'" % (_n, _n))
        else:
            exec("class Test%sUnix(%s):\n    compiler = ''" % (_n, _n))
        if gcc_exists():
            exec("class Test%sGcc(%s):\n    compiler = 'gcc'" % (_n, _n))


def setup_test_location():
    test_dir = tempfile.mkdtemp()
    sys.path.insert(0, test_dir)
    return test_dir


test_dir = setup_test_location()


def teardown_test_location():
    import tempfile
    test_dir = os.path.join(tempfile.gettempdir(), 'test_files')