Your IP : 216.73.216.52


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_parser.cpython-35.opt-2.pyc



���]fv�@s$ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
Gdd�dej�ZGdd�dej�Z
Gdd	�d	ej�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�Zedkr ej�dS)�N)�support)�assert_python_failurec@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?S)@�RoundtripLegalSyntaxTestCasecCs�||�}|j�}ytj|�}Wn?tjk
rl}z|jd||f�WYdd}~XnX|j||j�d�dS)Nzcould not roundtrip %r: %sz!could not re-generate syntax tree)�totuple�parser�sequence2st�ParserError�fail�assertEqual)�self�f�s�st1�t�st2�why�r�0/opt/alt/python35/lib64/python3.5/test_parser.py�	roundtrips*z&RoundtripLegalSyntaxTestCase.roundtripcCs|jtj|�dS)N)rr�expr)rr
rrr�
check_exprsz'RoundtripLegalSyntaxTestCase.check_exprcCsItjd�}|j�}i}t|i|�|j|dt�dS)Nz/from __future__ import unicode_literals; x = ''�x)r�suite�compile�execZassertIsInstance�str)rr�codeZscoperrr�test_flags_passed!s
z.RoundtripLegalSyntaxTestCase.test_flags_passedcCs|jtj|�dS)N)rrr)rr
rrr�check_suite*sz(RoundtripLegalSyntaxTestCase.check_suitecCs�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�|jd
�|jd�|jd�|jd�|jd�dS)Nzdef f(): yield 1zdef f(): yieldzdef f(): x += yieldzdef f(): x = yield 1zdef f(): x = y = yield 1zdef f(): x = yieldzdef f(): x = y = yieldzdef f(): 1 + (yield)*2zdef f(): (yield 1)*2zdef f(): return; yield 1zdef f(): yield 1; returnzdef f(): yield from 1zdef f(): x = yield from 1zdef f(): f((yield from 1))zdef f(): yield 1; return 1z1def f():
    for x in range(30):
        yield x
z)def f():
    if (yield):
        yield x
)r)rrrr�test_yield_statement-s"















z1RoundtripLegalSyntaxTestCase.test_yield_statementcCsR|jd�|jd�|jd�|jd�|jd�|jd�dS)Nzasync def f():
 await smth()z"async def f():
 foo = await smth()z'async def f():
 foo, bar = await smth()zasync def f():
 (await smth())z#async def f():
 foo((await smth()))z&async def f():
 await foo(); return 42)r)rrrr�test_await_statementDs




z1RoundtripLegalSyntaxTestCase.test_await_statementcCs|jd�|jd�dS)Nz"async def f():
 async with 1: passz/async def f():
 async with a as b, c as d: pass)r)rrrr�test_async_with_statementLs
z6RoundtripLegalSyntaxTestCase.test_async_with_statementcCs|jd�|jd�dS)Nz'async def f():
 async for i in (): passz*async def f():
 async for i, b in (): pass)r)rrrr�test_async_for_statementPs
z5RoundtripLegalSyntaxTestCase.test_async_for_statementcCs|jd�|jd�dS)Nz3def f():
    x = 0
    def g():
        nonlocal x
z:def f():
    x = y = 0
    def g():
        nonlocal x, y
)r)rrrr�test_nonlocal_statementTs
z4RoundtripLegalSyntaxTestCase.test_nonlocal_statementcCs|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�|jd
�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd �|jd!�|jd"�|jd#�|jd$�|jd%�|jd&�|jd'�|jd(�dS))Nzfoo(1)z	[1, 2, 3]z[x**3 for x in range(20)]z"[x**3 for x in range(20) if x % 3]z+[x**3 for x in range(20) if x % 2 if x % 3]zlist(x**3 for x in range(20))z&list(x**3 for x in range(20) if x % 3)z/list(x**3 for x in range(20) if x % 2 if x % 3)z
foo(*args)zfoo(*args, **kw)z	foo(**kw)zfoo(key=value)zfoo(key=value, *args)zfoo(key=value, *args, **kw)zfoo(key=value, **kw)zfoo(a, b, c, *args)zfoo(a, b, c, *args, **kw)zfoo(a, b, c, **kw)zfoo(a, *args, keyword=23)z	foo + barz	foo - barz	foo * barz	foo / barz
foo // barz	lambda: 0zlambda x: 0zlambda *y: 0zlambda *y, **z: 0z
lambda **z: 0zlambda x, y: 0zlambda foo=bar: 0z"lambda foo=bar, spaz=nifty+spit: 0zlambda foo=bar, **z: 0z#lambda foo=bar, blaz=blat+2, **z: 0z'lambda foo=bar, blaz=blat+2, *y, **z: 0zlambda x, *y, **z: 0z(x for x in range(10))zfoo(x for x in range(10))z...za[...])r)rrrr�test_expressions^sP






































z-RoundtripLegalSyntaxTestCase.test_expressionscCs|jd�dS)N�a)r)rrrr�test_simple_expression�sz3RoundtripLegalSyntaxTestCase.test_simple_expressioncCs|jd�|jd�dS)Nza = bza = b = c = d = e)r)rrrr�test_simple_assignments�s
z4RoundtripLegalSyntaxTestCase.test_simple_assignmentscCs�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�dS)
Nza += bza -= bza *= bza /= bza //= bza %= bza &= bza |= bza ^= bza <<= bza >>= bza **= b)r)rrrr�!test_simple_augmented_assignments�s










z>RoundtripLegalSyntaxTestCase.test_simple_augmented_assignmentscCs�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�|jd
�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd �|jd!�|jd"�|jd#�|jd$�dS)%Nz
def f(): passzdef f(*args): passzdef f(*args, **kw): passzdef f(**kw): passzdef f(foo=bar): passzdef f(foo=bar, *args): passz!def f(foo=bar, *args, **kw): passzdef f(foo=bar, **kw): passzdef f(a, b): passzdef f(a, b, *args): passzdef f(a, b, *args, **kw): passzdef f(a, b, **kw): passzdef f(a, b, foo=bar): passz!def f(a, b, foo=bar, *args): passz'def f(a, b, foo=bar, *args, **kw): passz def f(a, b, foo=bar, **kw): passz@staticmethod
def f(): passz,@staticmethod
@funcattrs(x, y)
def f(): passz@funcattrs()
def f(): passzdef f(*, a): passzdef f(*, a = 5): passzdef f(*, a = 5, b): passzdef f(*, a, b = 5): passz def f(*, a, b = 5, **kwds): passzdef f(*args, a): passzdef f(*args, a = 5): passzdef f(*args, a = 5, b): passzdef f(*args, a, b = 5): passz$def f(*args, a, b = 5, **kwds): passzdef f(a: int): passzdef f(a: int = 5): passzdef f(*args: list): passzdef f(**kwds: dict): passzdef f(*, a: int): passzdef f(*, a: int = 5): passzdef f() -> int: pass)r)rrrr�test_function_defs�sH


































z/RoundtripLegalSyntaxTestCase.test_function_defscCsE|jd�|jd�|jd�|jd�|jd�dS)Nzclass foo():passzclass foo(object):passz!@class_decorator
class foo():passz&@class_decorator(arg)
class foo():passz(@decorator1
@decorator2
class foo():pass)r)rrrr�test_class_defs�s




z,RoundtripLegalSyntaxTestCase.test_class_defscCs�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�|jd
�|jd�|jd�|jd�|jd�dS)Nzfrom sys.path import *zfrom sys.path import dirnamezfrom sys.path import (dirname)zfrom sys.path import (dirname,)z*from sys.path import dirname as my_dirnamez,from sys.path import (dirname as my_dirname)z-from sys.path import (dirname as my_dirname,)z&from sys.path import dirname, basenamez(from sys.path import (dirname, basename)z)from sys.path import (dirname, basename,)z4from sys.path import dirname as my_dirname, basenamez6from sys.path import (dirname as my_dirname, basename)z7from sys.path import (dirname as my_dirname, basename,)z5from sys.path import dirname, basename as my_basenamez7from sys.path import (dirname, basename as my_basename)z8from sys.path import (dirname, basename as my_basename,)zfrom .bogus import x)r)rrrr�test_import_from_statement�s.









z7RoundtripLegalSyntaxTestCase.test_import_from_statementcCsE|jd�|jd�|jd�|jd�|jd�dS)Nz
import syszimport sys as systemzimport sys, mathzimport sys as system, mathzimport sys, math as my_math)r)rrrr�test_basic_import_statement�s




z8RoundtripLegalSyntaxTestCase.test_basic_import_statementcCsl|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�dS)	Nzfrom . import namezfrom .. import namezfrom ... import namezfrom .... import namezfrom .pkg import namezfrom ..pkg import namezfrom ...pkg import namezfrom ....pkg import name)r)rrrr�test_relative_imports�s






z2RoundtripLegalSyntaxTestCase.test_relative_importscCs|jd�dS)Nz"# -*- coding: iso-8859-1 -*-
pass
)r)rrrr�test_pep263sz(RoundtripLegalSyntaxTestCase.test_pep263cCs|jd�dS)Nzassert alo < ahi and blo < bhi
)r)rrrr�test_assert	sz(RoundtripLegalSyntaxTestCase.test_assertcCs+|jd�|jd�|jd�dS)Nzwith open('x'): pass
zwith open('x') as f: pass
z*with open('x') as f, open('y') as g: pass
)r)rrrr�	test_withs

z&RoundtripLegalSyntaxTestCase.test_withcCsR|jd�|jd�|jd�|jd�|jd�|jd�dS)Nztry: pass
except: pass
ztry: pass
finally: pass
z'try: pass
except A: pass
finally: pass
z4try: pass
except A: pass
except: pass
finally: pass
z"try: pass
except: pass
else: pass
z0try: pass
except: pass
else: pass
finally: pass
)r)rrrr�
test_try_stmts




z*RoundtripLegalSyntaxTestCase.test_try_stmtcs�d}tj|�}|jdddd�}�fdd��t�|��}|jddd d!d"d#d$d&d'd(d)d*d+d-d/d1g|�dS)2Nzdef f(x):
    return x + 1Z	line_info�Zcol_infoc3sf|d}|d}t|t�r]x<|dd�D]"}x�|�D]}|VqGWq4Wn|VdS)Nrr2)�
isinstance�tuple)�treeZ	node_type�nextZeltr)�walkrrr7"s

z8RoundtripLegalSyntaxTestCase.test_position.<locals>.walk�defrr���(�r���)��:��	��return��+�
�1��)r2r8r2r)r2rr2r9)r:r;r2r<)r2rr2r=)r>r?r2r:)r@rAr2r>)r9rBr2rC���)r<rBrDrL)r2rErDr9)r2rrDr@)rFrGrDrH)rDrIrDrJ)r9rBrDrKrL)r=rBrDrLrL)r9rBrDrLrL)rrBrDrL)rrr�listr
)rrrrZ	terminalsr)r7r�
test_positions.
z*RoundtripLegalSyntaxTestCase.test_positioncCs8|jd�|jd�|jd�|jd�dS)Nz*a = yz
x, *b, = mz[*a, *b] = yzfor [*x, b] in x: pass)r)rrrr�test_extended_unpacking@s


z4RoundtripLegalSyntaxTestCase.test_extended_unpackingcCs+|jd�|jd�|jd�dS)Nzraise
zraise e
zBtry:
    suite
except Exception as e:
    raise ValueError from e
)r)rrrr�test_raise_statementFs

z1RoundtripLegalSyntaxTestCase.test_raise_statementcCs|jd�|jd�dS)Nz[]z[*{2}, 3, *[4]])r)rrrr�test_list_displaysNs
z/RoundtripLegalSyntaxTestCase.test_list_displayscCsE|jd�|jd�|jd�|jd�|jd�dS)Nz{*{2}, 3, *[4]}z{2}z{2,}z{2, 3}z{2, 3,})r)rrrr�test_set_displaysRs




z.RoundtripLegalSyntaxTestCase.test_set_displayscCs_|jd�|jd�|jd�|jd�|jd�|jd�|jd�dS)Nz{}z{a:b}z{a:b,}z
{a:b, c:d}z{a:b, c:d,}z{**{}}z{**{}, 3:4, **{5:6, 7:8}})r)rrrr�test_dict_displaysYs





z/RoundtripLegalSyntaxTestCase.test_dict_displayscCsE|jd�|jd�|jd�|jd�|jd�dS)Nz
f(*a, **b)zf(a, *b, *c, *d)zf(**a, **b)zf(2, *a, *b, **b, **c, **d)z0f(*b, *() or () and (), **{} and {}, **() or {}))r)rrrr�test_argument_unpackingbs




z4RoundtripLegalSyntaxTestCase.test_argument_unpackingcCs+|jd�|jd�|jd�dS)Nz{x for x in seq}z{f(x) for x in seq}z#{f(x) for x in seq if condition(x)})r)rrrr�test_set_comprehensionsis

z4RoundtripLegalSyntaxTestCase.test_set_comprehensionscCs+|jd�|jd�|jd�dS)Nz{x:x for x in seq}z({x**2:x[3] for x in seq if condition(x)}z4{x:x for x in seq1 for y in seq2 if condition(x, y)})r)rrrr�test_dict_comprehensionsns

z5RoundtripLegalSyntaxTestCase.test_dict_comprehensionsN)"�__name__�
__module__�__qualname__rrrrrr r!r"r#r$r&r'r(r)r*r+r,r-r.r/r0r1rNrOrPrQrRrSrTrUrVrrrrrs>	
*0
%	rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�IllegalSyntaxTestCasecCs>ytj|�Wntjk
r(YnX|jd|�dS)Nz"did not detect invalid tree for %r)rrrr	)rr5Zlabelrrr�check_bad_tree{s
z$IllegalSyntaxTestCase.check_bad_treecCs|jdd�dS)Nr2rD�z<junk>)r2rDr\)r[)rrrr�	test_junk�szIllegalSyntaxTestCase.test_junkc	Cs\d}|j|d
�d"}|j|d�d+}|j|d�d4}|j|d�dS)5N��
���r2r9rBrz too small items in terminal node�passz'non-string second item in terminal node�pass�0z'non-integer third item in terminal nodeztoo many items in terminal node�r2�rbrf�rarg�r9rB�r`rhri�r_rj�r9rB�rrB)r^rkrlrm�r2rc�rbrn�raro�r9rB�r`rprq�r_rr�r9rB�rrB)r^rsrtru�r2rdrer�rbrv�rarw�r9rB�r`rxry�r_rz�r9rB�rrB)r^r{r|r}�r2rdrr�rbr~�rar�r9rB�r`r�r��r_r��r9rB�rrB)r^r�r�r�)r[)rr5rrr�test_illegal_terminal�sPz+IllegalSyntaxTestCase.test_illegal_terminalc$Csdg}|j|d,�dS)hN����r2r8r�r:r;r>r?r@rA�#r9rBr<�	�
��rE�9�$�%�&�'�)�*�+�,�-�.�/�0�1rDrI��yieldr=rzdef f():
  return 1
  yield 1�r2r8�r2r�r:r;�r>r?�r�r�r��r@rA�r9rB�r<rB�r2rE�rDrI�r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r�r��r�r��r�r��r2r��rDrI�r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r�r��r�r��r�r��r9rB�r�r�r��r�r��r=rB�r�r�r�r��r�r��r�r�r�r��r�r�r�r�r�r��r9rB�rrB�r�r�r�r��r�r�)r�r�)r[)rr5rrr�test_illegal_yield_1�sfz*IllegalSyntaxTestCase.test_illegal_yield_1c%Csdy}|j|d3�dS)zN���	�
�r2�from��
__future__�import��
generatorsr9rB��r8r�r:r;r>r?r@rA�#r<��rE�9�$�%�&�'�)�*�+�,�-�.�/�0�1rDrI�r�r=rzdef f():
  return 1
  yield 1�r2r��r2r��r�r��r2r��r2r��r�r�r�r�r�r�r�r�r�r9rB�r�rr�r�r�r2r8�r2r�r:r;�r>r?�r�r	r
�r@rA�r9rB�r<rB�r2rE�rDrI�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r �r2r��rDrI�r�r#�r�r$�r�r%�r�r&�r�r'�r�r(�r�r)�r�r*�r�r+�r�r,�r�r-�r�r.�r�r/�r�r0�r�r"r1�r�r2�r�r3�r9rB�r�r4r5�r�r6�r=rB�r�r!r7r8�r�r9�r�r
rr:�r�rrrrr;�r9rB�rrB�r�r<r=r>�r�r?)r�rr@)r[)rr5rrr�test_illegal_yield_2�sxz*IllegalSyntaxTestCase.test_illegal_yield_2cCsd:}|j|d�dS);N��7�"�#�$�%�'�(�)�*�+�,�-�.�/r2r%��,�cr9rBrza,,c�r2r%�rPrT�rOrU�rNrV�rMrW�rLrX�rKrY�rJrZ�rIr[�rHr\�rGr]�rFr^�rEr_�rDr`�rQrR�rQrR�r2rS�rPrd�rOre�rNrf�rMrg�rLrh�rKri�rJrj�rIrk�rHrl�rGrm�rFrn�rEro�rDrp�rCrarbrcrq�r9rB�rrB)rBrrrsrt)r[)rr5rrr�test_a_comma_comma_c,s.z*IllegalSyntaxTestCase.test_a_comma_comma_ccCsdD}|j|d�dS)EN���	�
��8�#�$�%�&�(�)�*�+�,�-�.�/�0r2r%��%�$=�br9rBrza $= b�r2r%�r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��rr��r~r��r}r��r|r��r{r��r�r��r�r��r2r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��r�r��rr��r~r��r}r��r|r��r{r��rzr�r�r��ryr��r9rB�rxr�r��rwr��rrB)rvr�r�)r[)rr5rrr�test_illegal_operatorGs:z+IllegalSyntaxTestCase.test_illegal_operatorcCsd}|j|d�dS)N���	�
�r2�foor9rBrzmalformed global ast�r2r��r�r��r�r��r9rB�r�r�r��r�r��r9rB�rrB)r�r�r�r�)r[)rr5rrr�test_malformed_globalhsz+IllegalSyntaxTestCase.test_malformed_globalcCsd}|j|d�dS)N���
���r2r�r����fredr9rBrzfrom import fred�r2r��r2r��r2r��r�r��r�r��r�r�r�r��r�r��r�r��r9rB�r�r�r��r�r��r9rB�rrB)r�r�r�r�)r[)rr5rrr�test_missing_import_sourcessz0IllegalSyntaxTestCase.test_missing_import_sourcec	CsZd}|j|d�d}|j|d�d}|jt��tj|�WdQRXdS)N�R�rrBzmissed encoding�
iso-8859-1znon-string encoding���rrB�r�r�)r�r��rrB�r�r�)r�r�r��rrB�r�r�)r�r�r�)r[�assertRaises�UnicodeEncodeErrorrr)rr5rrr�test_illegal_encoding�sz+IllegalSyntaxTestCase.test_illegal_encodingN)
rWrXrYr[r]r�r�rArur�r�r�r�rrrrrZys.7@!rZc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�CompileTestCasecCs8tjd�}tj|�}|jt|�d�dS)Nz2 + 3r<)rr�	compilestr
�eval)r�strrrr�test_compile_expr�sz!CompileTestCase.test_compile_exprcCsItjd�}tj|�}i}t||�|j|dd�dS)Nzx = 2; y = x + 3�yr<)rrr�rr
)rr�rZglobsrrr�test_compile_suite�s

z"CompileTestCase.test_compile_suitecCs)tjd�}|jttj|�dS)Nz	1 = 3 + 4)rrr��SyntaxErrorr�)rr�rrr�test_compile_error�sz"CompileTestCase.test_compile_errorcCsNtjd�}|jttj|�tjd�}|jttj|�dS)Nza = "\U12345678"z	a = "\u1")rrr�r�r�)rr�rrr�test_compile_badunicode�sz'CompileTestCase.test_compile_badunicodecCs]tjd�}tj|�}|jt|�d�tj|�}|jt|�d�dS)Nz-3r\���r�)rrr�r
r�)rr��code1�code2rrr�test_issue_9011�s
zCompileTestCase.test_issue_9011cCs�tjd�}tj|�}|j|jd�|j�}|j|jd�xmddtd�td�fD]M}tj||�}|j|jd�|j|�}|j|jd�qoW|jt	tj|t
d��|jt	|jt
d��dS)Nza + 5z
<syntax-tree>zfile.pysfile.py)rrr�r
�co_filenamer�	bytearray�
memoryviewr��	TypeErrorrM)rr�r�filenamerrr�test_compile_filename�s	z%CompileTestCase.test_compile_filenameN)	rWrXrYr�r�r�r�r�r�rrrrr��s
r�c@s4eZdZdd�Zdd�Zdd�ZdS)�ParserStackLimitTestCasecCsd|d|S)N�[�]r)r�levelrrr�_nested_expression�sz+ParserStackLimitTestCase._nested_expressioncCs,|jd�}tj|�}|j�dS)N�])r�rrr)r�er�rrr�test_deeply_nested_list�sz0ParserStackLimitTestCase.test_deeply_nested_listcCsK|jd�}td|�\}}}|jd|�|jd|�dS)N�dz-css_push: parser stack overflowsMemoryError)r�rZassertIn)rr�rc�out�errrrr�test_trigger_memory_error�sz2ParserStackLimitTestCase.test_trigger_memory_errorN)rWrXrYr�rrrrrrr��sr�c@sFeZdZdd�Zdd�ZejZejdd��ZdS)�STObjectTestCasec
CsOtjd�}tjd�}tjd�}tjd�}tjd�}tjd�}|j||kd�|j||kd�|j||kd�|j||�|j||�|j||�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||kd�|j||k||k�|j||k||k�|j||k||k�|j||k||k�|j||k||k�|j||k||k�|j||k||k�|j||k||k�|j||k||k�t|||�}t|||�}t|||g�d}	|j||	k�|j||k�|j|	|k�|j||	k�|j||k�|j|	|k�|j||k�|j|	|	k�|j||k�|j|dkd�|jd|kd�|jt	t
j|d�|jt	t
jd|�|jt	t
j
|d	�|jt	t
jd
|�dS)Nz2 + 3zx = 2; y = x + 3zlist(x**3 for x in range(20))TFr2g��hҘ@zspanish armadaiswaterloo)rrrr
�min�max�sortedZ
assertTruer�r��operator�ge�le�lt�gt)
rrrZst3Zst1_copyZst2_copyZst3_copyZbottom�topZmidrrr�test_comparisons�sfz!STObjectTestCase.test_comparisonscCs�tjd�tjd�tjd�g}x�|D]�}tj|�}|j|j�|j��tj|�}|j|j�|j��xRttj	d�D]=}tj
tj||��}|j|j�|j��q�Wq1WdS)Nz2 + 3zx = 2; y = x + 3zlist(x**3 for x in range(20))r2)rrr�copyr
r�deepcopy�range�pickle�HIGHEST_PROTOCOL�loads�dumps)r�stsr�Zst_copy�protorrr�test_copy_pickles
z!STObjectTestCase.test_copy_picklecs�dd��tjd��tjd�����fdd������fdd�}|tjd	��|tjd
��|tjd��|tjd��|tjd
��|tjdddd��dS)NcSs:|dkr|S|dkr(|dd@Sd|dj�>S)Nr2�r\���)�
bit_length)�nrrr�
XXXROUNDUP0s
z0STObjectTestCase.test_sizeof.<locals>.XXXROUNDUPZPiiZhP3iP0hcs�|dkrdSd}t|�dko8t|dt�}|rY|t|d�d7}|ro|dd�n
|dd�}|r�|�t|���7}x|D]}|�|�7}q�W|S)Nrr2rLrLrL)�lenr3r)Znode�res�hasstrZchildrenZchild)r!�nodesize�sizeofchildrenrrr&9s%&
z4STObjectTestCase.test_sizeof.<locals>.sizeofchildrencs(�j|���|j���dS)N)�check_sizeofr)r�)�basesizer%rr&rr�check_st_sizeofGsz5STObjectTestCase.test_sizeof.<locals>.check_st_sizeofz2 + 3z	2 + 3 + 4z	x = 2 + 3rBz# -*- coding: utf-8 -*-r�z2,i�r�)rZcalcobjsize�struct�calcsizerrr)rr)r)r!r(r%rr&r�test_sizeof.szSTObjectTestCase.test_sizeofN)	rWrXrYrrrr'Zcpython_onlyr,rrrrr�s=	rc@seZdZdd�ZdS)�OtherParserCasec
Cs+|jt��tjdd�WdQRXdS)Nr%r�)r�r�rr)rrrr�test_two_args_to_exprWsz%OtherParserCase.test_two_args_to_exprN)rWrXrYr.rrrrr-Usr-�__main__)rrrZunittest�sysrr*ZtestrZtest.support.script_helperrZTestCaserrZr�r�rr-rW�mainrrrr�<module>s$�i�4x