%PDF- %PDF-
Direktori : /usr/local/lib/python2.7/test/ |
Current File : //usr/local/lib/python2.7/test/test_cmd_line_script.pyo |
ó Nêáac @ s d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z m Z m Z m Z e j j Z d d d g Z d Z e d „ Z e d d „ Z d Z d d „ Z d e j f d „ ƒ YZ d „ Z e d k rü e ƒ n d S( iÿÿÿÿN( t run_pythont temp_dirt make_scriptt compile_scriptt assert_python_failuret make_pkgt make_zip_scriptt make_zip_pkgt test1t test2t test3s # Script may be run with optimisation enabled, so don't rely on assert # statements being executed def assertEqual(lhs, rhs): if lhs != rhs: raise AssertionError('%r != %r' % (lhs, rhs)) def assertIdentical(lhs, rhs): if lhs is not rhs: raise AssertionError('%r is not %r' % (lhs, rhs)) # Check basic code execution result = ['Top level assignment'] def f(): result.append('Lower level reference') f() assertEqual(result, ['Top level assignment', 'Lower level reference']) # Check population of magic variables assertEqual(__name__, '__main__') print '__file__==%r' % __file__ print '__package__==%r' % __package__ # Check the sys module import sys assertIdentical(globals(), sys.modules[__name__].__dict__) print 'sys.argv[0]==%r' % sys.argv[0] c C s t | | | ƒ S( N( R ( t script_dirt script_basenamet source( ( s5 /usr/local/lib/python2.7/test/test_cmd_line_script.pyt _make_test_script+ s i c C s t | | | | | | ƒ S( N( R ( t zip_dirt zip_basenamet pkg_nameR R t depth( ( s5 /usr/local/lib/python2.7/test/test_cmd_line_script.pyt _make_test_zip_pkg. s sP import sys, os.path, runpy sys.path.insert(0, %s) runpy._run_module_as_main(%r) c C sA | d k r d } n t | ƒ } t | | f } t | | | ƒ S( Ns os.path.dirname(__file__)( t Nonet reprt launch_sourceR ( R R t module_namet pathR ( ( s5 /usr/local/lib/python2.7/test/test_cmd_line_script.pyt _make_launch_script= s t CmdLineTestc B sà e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z e j d „ ƒ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( c G sµ | | f } t | Œ \ } } t r6 d | GH| GHn | j | d ƒ d | } d | } d | } t r d GH| GH| GH| GHn | j | | ƒ | j | | ƒ | j | | ƒ d S( Ns Output from test script %r:i s __file__==%rs sys.argv[0]==%rs __package__==%rs Expected output:( R t verboset assertEqualt assertIn( t selft script_namet expected_filet expected_argv0t expected_packaget cmd_line_switchest run_argst exit_codet datat printed_filet printed_argv0t printed_package( ( s5 /usr/local/lib/python2.7/test/test_cmd_line_script.pyt _check_scriptF s"