Example #1
0
 def test_string_and_int(self):
     # decalaring variables
     a = 2;b = 'string'
     # declare module
     mod = ext_tools.ext_module('ext_string_and_int')
     code = """
            a=b.length();
            return_val = PyInt_FromLong(a);
            """
     test = ext_tools.ext_function('test',code,['a','b'])
     mod.add_function(test)
     mod.compile(location = build_dir)
     import ext_string_and_int
     c = ext_string_and_int.test(a,b)
     assert_(c == len(b))
Example #2
0
 def test_string_and_int(self):
     # decalaring variables
     a = 2;b = 'string'
     # declare module
     mod = ext_tools.ext_module('ext_string_and_int')
     code = """
            a=b.length();
            return_val = PyInt_FromLong(a);
            """
     test = ext_tools.ext_function('test',code,['a','b'])
     mod.add_function(test)
     mod.compile(location = build_dir)
     import ext_string_and_int
     c = ext_string_and_int.test(a,b)
     assert(c == len(b))
Example #3
0
    def test_string_and_int(self):
        # decalaring variables
        a = 2
        b = "string"
        # declare module
        mod = ext_tools.ext_module("ext_string_and_int")
        code = """
               a=b.length();
               return_val = PyInt_FromLong(a);
               """
        test = ext_tools.ext_function("test", code, ["a", "b"])
        mod.add_function(test)
        mod.compile(location=build_dir)
        import ext_string_and_int

        c = ext_string_and_int.test(a, b)
        assert_(c == len(b))