Esempio n. 1
0
def main():
    lib.f()
Esempio n. 2
0
import lib

lib.f()
Esempio n. 3
0
#!/usr/bin/env python

s = """
def f():
    print 'hello'
"""

import imp, sys
lib = imp.new_module('lib')
exec s in lib.__dict__
sys.modules['lib'] = lib
del s, imp, sys, lib

import lib
print lib.f()
Esempio n. 4
0
def test_lib_f():
    import lib
    assert lib.f(1, 2) == (1 * 2, 1 + 2)
    assert lib.f(0, 2) == (0, 2)
    assert lib.f(3, 0) == (0, 3)