Example #1
0
 def test_return_tuple(self):
     # decalaring variables
     a = 2
     # declare module
     mod = ext_tools.ext_module('ext_return_tuple')
     var_specs = ext_tools.assign_variable_types(['a'],locals())
     code = """
            int b;
            b = a + 1;
            py::tuple returned(2);
            returned[0] = a;
            returned[1] = b;
            return_val = returned;
            """
     test = ext_tools.ext_function('test',code,['a'])
     mod.add_function(test)
     mod.compile(location=build_dir)
     import ext_return_tuple
     c,d = ext_return_tuple.test(a)
     assert_(c == a and d == a+1)
 def test_return_tuple(self):
     # decalaring variables
     a = 2
     # declare module
     mod = ext_tools.ext_module('ext_return_tuple')
     var_specs = ext_tools.assign_variable_types(['a'],locals())
     code = """
            int b;
            b = a + 1;
            py::tuple returned(2);
            returned[0] = a;
            returned[1] = b;
            return_val = returned;
            """
     test = ext_tools.ext_function('test',code,['a'])
     mod.add_function(test)
     mod.compile(location=build_dir)
     import ext_return_tuple
     c,d = ext_return_tuple.test(a)
     assert_(c == a and d == a+1)