ó ükWc@s¤ddlZddlZddlZddlZddlmZddlZdejfd„ƒYZdejfd„ƒYZ d„Z e dkr ej ƒndS( i˙˙˙˙N(t test_supportt TestSpecificscBs(eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„ZejdkrĚd„Znd„Zd„Zd„Zd„Zd„Zejd„ƒZd„Z d„Z!d„Z"RS(cCs$tdddƒtdddƒdS(Nthistexecshi (tcompile(tself((s'/usr/lib/python2.7/test/test_compile.pyttest_no_ending_newline scCstdddƒdS(NtsR(R(R((s'/usr/lib/python2.7/test/test_compile.pyt test_emptyscCsDtdddƒtdddƒtdddƒtdddƒdS(Ns sRs shi stuff def f(): pass s(this_is really_old_mac def f(): pass(R(R((s'/usr/lib/python2.7/test/test_compile.pyttest_other_newlinesscCsR|jttdddƒddl}|j}t|ddƒt|d|ƒdS(Ns __debug__ = 1t?tsinglei˙˙˙˙t __debug__tsure(t assertRaisest SyntaxErrorRt __builtin__R tsetattr(RRtprev((s'/usr/lib/python2.7/test/test_compile.pyttest_debug_assignments   cBsÄ|jeedƒ|jeedƒ|jeedƒyddU|jdƒWnek renXyddU|jdƒWnek r’nXyddU|jd ƒWnek rżnXdS( Ns lambda a,a:0slambda a,a=1:0slambda a=1,a=1:0sdef f(a, a): passsduplicate argumentssdef f(a = 0, a = 1): passsduplicate keyword argumentssdef f(a): global a; a = 1svariable is global and local(RRtevaltfail(R((s'/usr/lib/python2.7/test/test_compile.pyttest_argument_handlings$   cCs|jttdddƒdS(Ns1+*3tfilenameR(RRR(R((s'/usr/lib/python2.7/test/test_compile.pyttest_syntax_error4scCs|jttdddƒdS(Ns f(None=1)sR(RRR(R((s'/usr/lib/python2.7/test/test_compile.pyttest_none_keyword_arg7scBs1yddU|jdƒWnek r,nXdS(Nsdef f(a): global a; a = 1svariable is global and local(RR(R((s'/usr/lib/python2.7/test/test_compile.pyttest_duplicate_global_local:s  c Bs+idd6}d|U|j|ddƒidd6}idd6dd6}d ||U|jd|ƒ|j|dd ƒ|jeƒ d dUWdQX|jeƒdiiifdUWdQXidd6d d6}i}|jeƒd|f|UWdQX|jeƒd||f||UWdQXdS( Nitbs a = b + 1taiiitcs a = b + ci i(s a = b + 1(t assertEqualt assertNotInRt TypeError(Rtgtl((s'/usr/lib/python2.7/test/test_compile.pyttest_exec_functional_styleAs$   cCs4dddg}x|D]}t|ddƒqWdS(NsN def g(): def f(): if True: exec "" in {}, {} sM def g(): def f(): if True: exec("", {}, {}) sI def g(): def f(): if True: exec("", {}) sR(R(RtcodeR((s'/usr/lib/python2.7/test/test_compile.pyttest_nested_qualified_exec]s   cBs™ddd„ƒY}|ƒ}eƒ}d||U|j|jdƒyd||UWnek rcnX|jdƒd||U|j|jded ƒfƒd ||U|j|jd|fƒd ||U|j|jd|fƒy d|UWnek r˙nX|jd ƒd dd„ƒY}|ƒ}yd||UWnek rJnX|jdƒdefd„ƒY}|ƒ}d||U|j|ddƒdS(NtMcBs)eZdZd„Zd„Zd„ZRS(s9Test mapping interface versus possible calls from eval().cSs|dkrdSt‚dS(NRi (tKeyError(Rtkey((s'/usr/lib/python2.7/test/test_compile.pyt __getitem__vs cSs||f|_dS(N(tresults(RR(tvalue((s'/usr/lib/python2.7/test/test_compile.pyt __setitem__zscSs tdƒS(Ntxyz(tlist(R((s'/usr/lib/python2.7/test/test_compile.pytkeys|s(t__name__t __module__t__doc__R)R,R/(((s'/usr/lib/python2.7/test/test_compile.pyR&ts  sz = atzi sz = bsDid not detect a KeyErrors z = dir()R-s z = globals()s z = locals()s'Did not validate globals as a real dicttAcBseZdZRS(s Non-mapping(R0R1R2(((s'/usr/lib/python2.7/test/test_compile.pyR4–ss$Did not validate locals as a mappingtDcBseZd„ZRS(cSs |dkrdStj||ƒS(NRi (tdictR)(RR(((s'/usr/lib/python2.7/test/test_compile.pyR)Łs (R0R1R)(((s'/usr/lib/python2.7/test/test_compile.pyR5˘s((R3i ((tglobalsRR*t NameErrorRR.R R6(RR&tmR!R4R5td((s'/usr/lib/python2.7/test/test_compile.pyt)test_exec_with_general_mapping_for_localsrs@                cBsAddd}d|fd}|dU|jedƒdƒdS(Ns x = x or s-xiÄ sŢ def f(x): %s %s %s %s %s %s %s %s %s %s # the expressions above have no effect, x == argument while x: x -= 1 # EXTENDED_ARG/JUMP_ABSOLUTE here return x i ii(Rtf(RtlongexprR$((s'/usr/lib/python2.7/test/test_compile.pyttest_extended_argŤscBs1ejdefƒejdƒdUWdQXdS(Ns*tuple parameter unpacking has been removeds> def comp_args((a, b)): return a,b self.assertEqual(comp_args((1, 2)), (1, 2)) def comp_args((a, b)=(3, 4)): return a, b self.assertEqual(comp_args((1, 2)), (1, 2)) self.assertEqual(comp_args(), (3, 4)) def comp_args(a, (b, c)): return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) def comp_args(a=2, (b, c)=(3, 4)): return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) self.assertEqual(comp_args(), (2, 3, 4)) (Rtcheck_py3k_warningst SyntaxWarningttextwraptdedent(R((s'/usr/lib/python2.7/test/test_compile.pyttest_complex_argsÂscBs1yddU|jdƒWnek r,nXdS(Nsdef f(a=1, (b, c)): passsnon-default args after default(RR(R((s'/usr/lib/python2.7/test/test_compile.pyttest_argument_orderÚs  cCsP|jttdƒ|jttdƒ|jttdƒ|jttdƒdS(Nt2es2.0e+s1e-s3-4e/21(RRR(R((s'/usr/lib/python2.7/test/test_compile.pyttest_float_literalsáscCsd}t|ddƒdS(Ns if 1: if 2: passsR(R(Rts((s'/usr/lib/python2.7/test/test_compile.pyttest_indentationčscCsYdjdgddgƒ}t|ddƒ}|j|jdƒ|j|jdƒdS(NRs itspamtfnRi(tjoinRRtco_firstlinenot co_lnotab(Rts256tco((s'/usr/lib/python2.7/test/test_compile.pyttest_leading_newlinesôscCs!xZddddddddd d d d d ddddddgD]}|jtt|ƒq@W|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtdƒdƒ|jtd ƒd!ƒ|jtd"ƒd#ƒ|jtd$ƒd#ƒ|jtd%ƒd&ƒ|jtd'ƒd(ƒ|jtd)ƒd*ƒ|jtd+ƒd#ƒ|jtd,ƒd#ƒ|jtd-ƒd.ƒ|jtd/ƒd.ƒ|jtd0ƒd.ƒ|jtd1ƒd.ƒ|jtd2ƒd3ƒ|jtd4ƒd5ƒ|jtd6ƒd7ƒ|jtd8ƒd9ƒ|jtd:ƒd;ƒ|jtd<ƒd=ƒ|jtd>ƒdƒ|jtd?ƒd@ƒ|jtdAƒdBƒ|jtdCƒdDƒ|jtdEƒdFƒdS(GNt077787t0xjs0x.t0et090000000000000t080000000000000t000000000000009t000000000000008t0b42t0BADCAFEt 0o123456789s0b1.1s0o4.2t0b101j2t0o153j2t0b100e1t0o777e1t0o8t0o78t0777i˙t0777Lt000777t0xffi˙t0xffLt0XfFs0777.i s0777.0t8000000000000000000000000000000000000000000000000000777e0t0777e1iZt0e0is 0000E-012s09.5g#@t0777jyHˆ@t00jys00.0t0e3s090000000000000.g聰vÔBs&090000000000000.0000000000000000000000t090000000000000e0s090000000000000e-0t090000000000000jy聰vÔBt000000000000007is000000000000008.g @s000000000000009.g"@t0b101010i*s-0b000000000010iţ˙˙˙t0o777s -0o0000010iř˙˙˙s020000000000.0g _ Bt037777777777e0gâHv—!Bs01000000000000000000000.0gPďâÖäKD(RRRR(Rtarg((s'/usr/lib/python2.7/test/test_compile.pyt!test_literals_with_leading_zeroesúsL cCsĺtjdkrHd}|jt|ƒdƒ|jtd|ƒdƒnUtjdkrd}|jt|ƒdƒ|jtd|ƒd ƒn |jd ƒ|jtd tj d ƒtƒ|jtd tj d ƒtƒdS(Ni˙˙˙t 0xffffffffl˙˙t-lý˙˙˙˙˙l˙˙˙˙t0xffffffffffffffffl˙˙˙˙lű˙˙˙˙˙˙˙s)How many bits *does* this machine have???s%sii(tsystmaxintRRRtassertIsInstancetinttlong(Rt all_one_bits((s'/usr/lib/python2.7/test/test_compile.pyttest_unary_minus#s "l˙˙˙˙c Csqd }d}d }d}d }d}d }d}x6|jjjD]%} | dk rD|j| tƒqDqDWdS( Nllý˙˙˙llü˙˙˙llű˙˙˙l˙˙˙˙lű˙˙˙˙˙˙˙(ttest_32_63_bit_valuest func_codet co_conststNoneRzR{( RRRRR:teR<R!thtvariable((s'/usr/lib/python2.7/test/test_compile.pyR7s cCs6dp d\}}|j|dƒ|j|dƒdS(Nii˙˙˙˙(ii˙˙˙˙(i˙˙˙˙i(R(Rtitj((s'/usr/lib/python2.7/test/test_compile.pyttest_sequence_unpacking_errorEsc CsŤddddddddd d d d g }xJ|D]B}|d 7}|jtt|ddƒ|jtt|ddƒq1WtdddƒtdddƒtdddƒdS(NsNone = 0s None += 0s__builtins__.None = 0sdef None(): passsclass None: passs(a, None) = 0, 0sfor None in range(10): passsdef f(None): passs import Nonesimport x as Nonesfrom x import Nonesfrom x import y as Nones ttmpR Rsfrom None import xsfrom x import None as ysimport None as x(RRR(Rtstmtststmt((s'/usr/lib/python2.7/test/test_compile.pyttest_none_assignmentKs&   cCsÇddddddddd d d d d ddg}ddddddddddddddddd d!d"d#d$g}x|D]}t|d%d&ƒqWx'|D]}|jtt|d%d&ƒq WdS('Ns import syssimport os, syssimport os as barsimport os.path as bars0from __future__ import nested_scopes, generatorss2from __future__ import (nested_scopes, generators)s3from __future__ import (nested_scopes, generators,)s%from sys import stdin, stderr, stdouts'from sys import (stdin, stderr, stdout)s(from sys import (stdin, stderr, stdout,)s(from sys import (stdin , stderr, stdout)s)from sys import (stdin , stderr, stdout,)s7from sys import stdin as si, stdout as so, stderr as ses9from sys import (stdin as si, stdout as so, stderr as se)s:from sys import (stdin as si, stdout as so, stderr as se,)simport (os, sys)simport (os), (sys)simport ((os), (sys))s import (syss import sys)s import (os,)simport os As barsimport os.path a barsfrom sys import stdin As stdoutsfrom sys import stdin a stdoutsfrom (sys) import stdins%from __future__ import (nested_scopess%from __future__ import nested_scopes)s0from __future__ import nested_scopes, generatorssfrom sys import (stdinsfrom sys import stdin)s%from sys import stdin, stdout, stderrsfrom sys import stdin sis)from sys import stdin,from sys import (*)s(from sys import (stdin,, stdout, stderr)s from sys import (stdin, stdout),R‰R(RRR(RtsucceedRR‹((s'/usr/lib/python2.7/test/test_compile.pyt test_importcsP    cCs>d„}|ƒ\}}|jt|jƒt|jƒƒdS(NcSs"dd„}dd„}||fS(NicSs|S(N((tx((s'/usr/lib/python2.7/test/test_compile.pyt•sicSs|S(N((R((s'/usr/lib/python2.7/test/test_compile.pyR–s((tf1tf2((s'/usr/lib/python2.7/test/test_compile.pyR<”s  (tassertNotEqualtidR€(RR<R‘R’((s'/usr/lib/python2.7/test/test_compile.pyttest_for_distinct_code_objects’s cCsd„}|j|jƒdS(NcSsdS(Ntfoo((((s'/usr/lib/python2.7/test/test_compile.pyRœs(t assertIsNoneR2(RR"((s'/usr/lib/python2.7/test/test_compile.pyttest_lambda_doc›s cCsód}|jtt|ddƒd}|jtt|ddƒd}|jt|ƒdƒd}|jt|ƒdƒd}|jt|ƒdƒd }|jt|ƒd ƒd }|jt|ƒtjd ƒƒd }|jt|ƒdƒdS(Ns## -*- coding: badencoding -*- pass R‰Ru# -*- coding: utf-8 -*- pass su"¤" u¤uu"¤" s# -*- coding: latin1 -*- u"¤" s# -*- coding: utf-8 -*- u"¤" u¤s## -*- coding: iso8859-15 -*- u"¤" s \xc2\u20acs$u"""\ # -*- coding: utf-8 -*- ¤""" u# -*- coding: utf-8 -*- ¤(RRRRRRtu(RR$((s'/usr/lib/python2.7/test/test_compile.pyt test_encodingŸs cCsJdtfd„ƒY}|ƒ}d|d<|j|ddƒ|dcd7<|j|ddƒ|d=|jd|ƒd|d<|j|ddƒ|d cd7<|j|d dƒ|d =|jd |ƒd|dd+|j|dd!dƒ|ddc!d7+|j|dd!dƒ|dd5|jtddƒ|ƒd|dd…dd…f<|j|dd…dd…fdƒ|dd…dd…fcd7<|j|dd…dd…fdƒ|dd…dd…f=|jtddƒtddƒf|ƒd|ddd…<|j|ddd…dƒ|ddd…cd7<|j|ddd…dƒ|ddd…=|jtdddƒ|ƒd|ddd…ddd…f<|j|ddd…ddd…fdƒ|ddd…ddd…fcd7<|j|ddd…ddd…fdƒ|ddd…ddd…f=|jtdddƒtdddƒf|ƒd|d<|j|ddƒ|dcd7<|j|ddƒ|d=|jt|ƒd|d <|j|ddƒ|dcd7<|j|ddƒ|d=|jttf|ƒdS(Ntstr_mapcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cSs i|_dS(N(tdata(R((s'/usr/lib/python2.7/test/test_compile.pyt__init__śscSs|jt|ƒS(N(Rœtstr(RR(((s'/usr/lib/python2.7/test/test_compile.pyR)¸scSs||jt|ƒsx = 5ssprint 1ssprint vs s print Trues sprint []s sif True: pass s s for n in [1, 2, 3]: print n s sdef foo(): pass foo() s%s1Rs%s2s%s3ssR(R­RŽ(t__file__tlowertendswithtopentreadRt_astt PyCF_ONLY_ASTt assertTruettypetModuleRt co_filenameRR tIftBoolOptbody( RtfnameR<t fcontentst sample_codeR$tco1tasttco2((s'/usr/lib/python2.7/test/test_compile.pyttest_compile_asts6          (#R0R1RRR RRRRRR#R%R;R>RCRDRFRHRPRtR~RxRyRRˆRŒRŽR•R˜Rtrequires_unicodeRšR¤RŹRÄ(((s'/usr/lib/python2.7/test/test_compile.pyRs<           9      )     /  H t TestStackSizecBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( idcCs\t|tƒr$t|ddƒ}ntjtjt|jƒƒƒ}|j|j |ƒdS(NsR ( t isinstanceRžRtmathtceiltlogtlentco_codetassertLessEqualt co_stacksize(RR$tmax_size((s'/usr/lib/python2.7/test/test_compile.pytcheck_stack_size5s!cCs|jd|jdƒdS(Nsx and R(RĐtN(R((s'/usr/lib/python2.7/test/test_compile.pyttest_and=scCs|jd|jdƒdS(Nsx or R(RĐRŃ(R((s'/usr/lib/python2.7/test/test_compile.pyttest_or@scCs|jd|jdƒdS(Ns x and x or R(RĐRŃ(R((s'/usr/lib/python2.7/test/test_compile.pyt test_and_orCscCs|jd|jdƒdS(Nsx < R(RĐRŃ(R((s'/usr/lib/python2.7/test/test_compile.pyttest_chained_comparisonFscCs|jd|jdƒdS(Ns x if x else R(RĐRŃ(R((s'/usr/lib/python2.7/test/test_compile.pyt test_if_elseIscCs|jd|jdƒdS(Nsx + R(RĐRŃ(R((s'/usr/lib/python2.7/test/test_compile.pyt test_binopLscCs(d}|d|j7}|j|ƒdS(Ns def f(x): s x and x (RŃRĐ(RR$((s'/usr/lib/python2.7/test/test_compile.pyt test_func_andOs( R0R1RŃRĐRŇRÓRÔRŐRÖR×RŘ(((s'/usr/lib/python2.7/test/test_compile.pyRĆ/s       cCstjtƒdS(N(Rt run_unittestR0(((s'/usr/lib/python2.7/test/test_compile.pyt test_mainUst__main__( RČtunittestRxRľttestRRAtTestCaseRRĆRÚR0tmain(((s'/usr/lib/python2.7/test/test_compile.pyts     ˙˙)&