tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Y\¬Qc@€svdZddlmZddlmZddlmZmZddlZddlZddl    m
Z
dd    l m Z dd
l mZd ejfd „ƒYZd ejfd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdejfd„ƒYZdefd„ƒYZd„ZdS( sFTest suite for 2to3's parser and grammar files.
 
This is the place to add tests for changes to 2to3's grammar, such as those
merging the grammars for Python 2 and 3. In addition to specific tests for
parts of the grammar we've changed, we also make sure we can parse the
test_grammar.py files from both Python 2 and Python 3.
iÿÿÿÿ(twith_statementi(tsupport(tdriverttest_dirN(ttokenizei(t
ParseError(tpython_symbolst
TestDrivercB€seZd„ZRS(cC€sad}tj|ƒ}|j|jdjdjtjƒ|j|jdjdjtjƒdS(Nsprint 1
print 2
ii(Rt parse_stringt assertEqualtchildrenttypetsymst
print_stmt(tselftstt((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyt test_formfeeds$(t__name__t
__module__R(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyRst GrammarTestcB€seZd„Zd„ZRS(cC€stj|ƒdS(N(RR(Rtcode((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pytvalidate#scC€s5y|j|ƒWntk
r$n Xtdƒ‚dS(Ns Syntax shouldn't have been valid(RRtAssertionError(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pytinvalid_syntax&s
 (RRRR(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR"s    tTestRaiseChangescB€sYeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
RS(    cC€s|jdƒdS(Ntraise(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_2x_style_10scC€s|jdƒdS(Ns
raise E, V(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_2x_style_23scC€s|jdƒdS(Ns raise E, V, T(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_2x_style_36scC€s|jdƒdS(Nsraise E, V, T, Z(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_2x_style_invalid_19scC€s|jdƒdS(Nsraise E1 from E2(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyt test_3x_style<scC€s|jdƒdS(Nsraise E, V from E1(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_3x_style_invalid_1?scC€s|jdƒdS(Nsraise E from E1, E2(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_3x_style_invalid_2BscC€s|jdƒdS(Nsraise from E1, E2(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_3x_style_invalid_3EscC€s|jdƒdS(Ns raise E from(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_3x_style_invalid_4Hs( RRRRRRRR R!R"R#(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR/s                                tTestFunctionAnnotationscB€sPeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    RS(cC€s|jdƒdS(Nsdef f(x) -> list: pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_1NscC€s|jdƒdS(Nsdef f(x:int): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_2QscC€s|jdƒdS(Nsdef f(*x:str): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_3TscC€s|jdƒdS(Nsdef f(**x:float): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_4WscC€s|jdƒdS(Nsdef f(x, y:1+2): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_5ZscC€s|jdƒdS(Nsdef f(a, (b:1, c:2, d)): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_6]scC€s|jdƒdS(Ns/def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_7`scC€sd}|j|ƒdS(Nsgdef f(a, (b:1, c:2, d), e:3=4, f=5,
                        *g:6, h:7, i=8, j:9=10, **k:11) -> 12: pass(R(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_8cs(
RRR%R&R'R(R)R*R+R,(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR$Ms                            t
TestExceptcB€seZd„Zd„ZRS(cC€sd}|j|ƒdS(NsP
            try:
                x
            except E as N:
                y(R(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_newjscC€sd}|j|ƒdS(NsN
            try:
                x
            except E, N:
                y(R(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_oldrs(RRR.R/(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR-is    tTestSetLiteralcB€s,eZd„Zd„Zd„Zd„ZRS(cC€s|jdƒdS(Ns x = {'one'}(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR%}scC€s|jdƒdS(Nsx = {'one', 1,}(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR&€scC€s|jdƒdS(Nsx = {'one', 'two', 'three'}(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR'ƒscC€s|jdƒdS(Nsx = {2, 3, 4,}(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR(†s(RRR%R&R'R((((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR0|s            tTestNumericLiteralscB€seZd„Zd„ZRS(cC€s|jdƒ|jdƒdS(Nt0o7777777777777t 0o7324528887(RR(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_new_octal_notation‹s cC€s|jdƒ|jdƒdS(Nt0b101010t    0b0101021(RR(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_new_binary_notations (RRR4R7(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR1Šs    t TestClassDefcB€seZd„ZRS(cC€sE|jdƒ|jdƒ|jdƒ|jdƒ|jdƒdS(Nsclass B(t=7): passsclass B(t, *args): passsclass B(t, **kwargs): passs!class B(t, *args, **kwargs): passs&class B(t, y=9, *args, **kwargs): pass(R(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_new_syntax•s
    (RRR9(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR8”stTestParserIdempotencycB€s eZdZd„Zd„ZRS(s,A cut-down version of pytree_idempotency.py.cC€sítjjdƒrdSxÐtjƒD]Â}t|dƒ}tj|jƒd}WdQX|j    |dk    d|ƒt|dƒ"}|j ƒ}|j |ƒ}WdQXt j|ƒ}t|ƒ}t|||ƒr#|jd|ƒq#q#WdS(Ntwintrbiscan't detect encoding for %strsIdempotency failed: %s(tsystplatformt
startswithRtall_project_filestopenRtdetect_encodingtreadlinet
assertTruetNonetreadtdecodeRRtunicodetdifftfail(Rtfilepathtfptencodingtsourcettreetnew((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_all_project_files¡s   cC€s8tjdƒtjdƒtjdƒtjdƒdS(Ns a, *b, c = x
s [*a, b] = x
s(z, *y, w) = m
sfor *z, m in d: pass
(RR(R((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_extended_unpacking²s   (RRt__doc__RRRS(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyR:s    t TestLiteralscB€s,eZd„Zd„Zd„Zd„ZRS(cC€stjtj|ƒdƒdS(Ns
 
(RRRtdedent(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyRºscC€sd}|j|ƒdS(Nsá
            md5test(b"ª" * 80,
                    (b"Test Using Larger Than Block-Size Key "
                     b"and Larger Than One Block-Size Data"),
                    "6f630fad67cda0ee1fb1f562db3aa53e")
            (R(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_multiline_bytes_literals½scC€sd}|j|ƒdS(Ns¬
            b"""
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN">
            """
            (R(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyt'test_multiline_bytes_tripquote_literalsÆscC€sd}|j|ƒdS(NsÞ
            md5test("ª" * 80,
                    ("Test Using Larger Than Block-Size Key "
                     "and Larger Than One Block-Size Data"),
                    "6f630fad67cda0ee1fb1f562db3aa53e")
            (R(RR((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyttest_multiline_str_literalsÏs(RRRRWRXRY(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyRU¸s                    cC€sstddƒ}z|j|j|ƒƒWd|jƒXz'|jddƒ}tjd|ƒSWdtjdƒXdS(Nt@twt"s\"sdiff -u "%s" @(RBtwritetencodetclosetreplacetostsystemtremove(tfntresultRNtf((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyRJÙs (RTt
__future__RtRRRRaR>t lib2to3.pgen2Rt pgen2.parseRtlib2to3.pygramRR tTestCaseRRRR$R-R0R1R8R:RURJ(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/tests/test_parser.pyt<module>s&       
    !