test_future.py

来自「mallet是自然语言处理、机器学习领域的一个开源项目。」· Python 代码 · 共 48 行

PY
48
字号
# Test various flavors of legal and illegal future statementsfrom test_support import unloadimport rerx = re.compile('\((\S+).py, line (\d+)')def check_error_location(msg):    mo = rx.search(msg)    print "SyntaxError %s %s" % mo.group(1, 2)# The first two tests should workunload('test_future1')import test_future1unload('test_future2')import test_future2unload('test_future3')import test_future3# The remaining tests should failtry:    import badsyntax_future3except SyntaxError, msg:    check_error_location(str(msg))try:    import badsyntax_future4except SyntaxError, msg:    check_error_location(str(msg))try:    import badsyntax_future5except SyntaxError, msg:    check_error_location(str(msg))try:    import badsyntax_future6except SyntaxError, msg:    check_error_location(str(msg))try:    import badsyntax_future7except SyntaxError, msg:    check_error_location(str(msg))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?