def inner_func():
     import module2
     assert True == ('module2' in locals())
     return module2.greet("jack")
 def inner_func():
     import module2
     assert True == ('module2' in locals())
     return module2.greet("jack")
def test_module_usage_multiple():
    import module1
    import module2

    assert "module1 says hi to jack" == module1.greet("jack")
    assert "module2 says hi to jack" == module2.greet("jack")
def test_module_usage_multiple():
    import module1
    import module2

    assert 'module1 says hi to jack' == module1.greet("jack")
    assert 'module2 says hi to jack' == module2.greet("jack")
def test_module_usage_multiple():
    import module1
    import module2

    assert __ == module1.greet("jack")
    assert __ == module2.greet("jack")
Esempio n. 6
0
#! /usr/bin/env python
# coding:utf-8
"""引用父目录的 模块,虽然报错,但是可以引用的父目录的模块"""

import sys

sys.path.append("..")

import module2

__author__ = 'xudazhou'

reload(sys)
# sys.setdefaultencoding("gbk")

module2.greet()

print("我是 hellogreet")  # 中文输出乱码

print("finish!")

# 打印当前模块的 docStrings
print(__doc__)
def test_module_usage_multiple():
    import module1
    import module2

    assert __ == module1.greet("jack")
    assert __ == module2.greet("jack")
 def inner_func():
     import module2
     assert False == (module2 in locals())
     return module2.greet("jack")