2016-01-25 19:40:57 -04:00
import ast
import dis
2011-08-09 18:15:04 -03:00
import os
import sys
import unittest
2012-07-08 15:13:36 -03:00
import weakref
from test import support
2006-02-28 14:44:41 -04:00
def to_tuple ( t ) :
2007-10-16 15:12:55 -03:00
if t is None or isinstance ( t , ( str , int , complex ) ) :
2006-02-28 14:44:41 -04:00
return t
elif isinstance ( t , list ) :
return [ to_tuple ( e ) for e in t ]
result = [ t . __class__ . __name__ ]
2006-03-01 18:49:05 -04:00
if hasattr ( t , ' lineno ' ) and hasattr ( t , ' col_offset ' ) :
result . append ( ( t . lineno , t . col_offset ) )
2006-02-28 14:44:41 -04:00
if t . _fields is None :
return tuple ( result )
for f in t . _fields :
result . append ( to_tuple ( getattr ( t , f ) ) )
return tuple ( result )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
2006-02-28 14:44:41 -04:00
# These tests are compiled through "exec"
2013-08-17 10:57:41 -03:00
# There should be at least one test per statement
2006-02-28 14:44:41 -04:00
exec_tests = [
2011-06-27 19:46:06 -03:00
# None
" None " ,
2017-02-22 11:31:59 -04:00
# Module docstring
" ' module docstring ' " ,
2006-02-28 14:44:41 -04:00
# FunctionDef
" def f(): pass " ,
2017-02-22 11:31:59 -04:00
# FunctionDef with docstring
" def f(): ' function docstring ' " ,
2011-06-27 19:46:06 -03:00
# FunctionDef with arg
" def f(a): pass " ,
# FunctionDef with arg and default value
" def f(a=0): pass " ,
# FunctionDef with varargs
" def f(*args): pass " ,
# FunctionDef with kwargs
" def f(**kwargs): pass " ,
2017-02-22 11:31:59 -04:00
# FunctionDef with all kind of args and docstring
" def f(a, b=1, c=None, d=[], e= {} , *args, f=42, **kwargs): ' doc for f() ' " ,
2006-02-28 14:44:41 -04:00
# ClassDef
" class C:pass " ,
2017-02-22 11:31:59 -04:00
# ClassDef with docstring
" class C: ' docstring for class C ' " ,
2011-06-27 19:46:06 -03:00
# ClassDef, new style class
" class C(object): pass " ,
2006-02-28 14:44:41 -04:00
# Return
" def f():return 1 " ,
# Delete
" del v " ,
# Assign
" v = 1 " ,
# AugAssign
" v += 1 " ,
# For
" for v in v:pass " ,
# While
" while v:pass " ,
# If
" if v:pass " ,
2011-05-27 17:02:03 -03:00
# With
" with x as y: pass " ,
" with x as y, z as q: pass " ,
2006-02-28 14:44:41 -04:00
# Raise
2007-08-30 21:04:24 -03:00
" raise Exception( ' string ' ) " ,
2006-02-28 14:44:41 -04:00
# TryExcept
" try: \n pass \n except Exception: \n pass " ,
# TryFinally
" try: \n pass \n finally: \n pass " ,
# Assert
" assert v " ,
# Import
" import sys " ,
# ImportFrom
" from sys import v " ,
# Global
" global v " ,
# Expr
" 1 " ,
# Pass,
" pass " ,
# Break
2015-09-01 17:10:49 -03:00
" for v in v:break " ,
2006-02-28 14:44:41 -04:00
# Continue
2015-09-01 17:10:49 -03:00
" for v in v:continue " ,
2009-09-11 19:36:20 -03:00
# for statements with naked tuples (see http://bugs.python.org/issue6704)
" for a,b in c: pass " ,
" [(a,b) for a,b in c] " ,
" ((a,b) for a,b in c) " ,
2011-06-27 19:46:06 -03:00
" ((a,b) for (a,b) in c) " ,
# Multiline generator expression (test for .lineno & .col_offset)
""" (
(
Aa
,
Bb
)
for
Aa
,
Bb in Cc
) """ ,
# dictcomp
" { a : b for w in x for m in p if g} " ,
# dictcomp with naked tuple
" { a : b for v,w in x} " ,
# setcomp
" { r for l in x if g} " ,
# setcomp with naked tuple
" { r for l,m in x} " ,
2015-05-11 23:57:16 -03:00
# AsyncFunctionDef
2017-02-22 11:31:59 -04:00
" async def f(): \n ' async function ' \n await something() " ,
2015-05-11 23:57:16 -03:00
# AsyncFor
" async def f(): \n async for e in i: 1 \n else: 2 " ,
# AsyncWith
" async def f(): \n async with a as b: 1 " ,
2015-09-01 17:10:49 -03:00
# PEP 448: Additional Unpacking Generalizations
" { ** {1:2} , 2:3} " ,
" { * { 1, 2}, 3} " ,
2016-09-09 14:36:01 -03:00
# Asynchronous comprehensions
" async def f(): \n [i async for b in c] " ,
2006-02-28 14:44:41 -04:00
]
# These are compiled through "single"
# because of overlap with "eval", it just tests what
# can't be tested with "eval"
single_tests = [
" 1+2 "
]
# These are compiled through "eval"
# It should test all expressions
eval_tests = [
2011-06-27 19:46:06 -03:00
# None
" None " ,
2006-02-28 14:44:41 -04:00
# BoolOp
" a and b " ,
# BinOp
" a + b " ,
# UnaryOp
" not v " ,
# Lambda
" lambda:None " ,
# Dict
" { 1:2 } " ,
2011-06-27 19:46:06 -03:00
# Empty dict
" {} " ,
# Set
" { None,} " ,
# Multiline dict (test for .lineno & .col_offset)
""" {
1
:
2
} """ ,
2006-02-28 14:44:41 -04:00
# ListComp
" [a for b in c if d] " ,
# GeneratorExp
" (a for b in c if d) " ,
# Yield - yield expressions can't work outside a function
#
# Compare
" 1 < 2 < 3 " ,
# Call
" f(1,2,c=3,*d,**e) " ,
# Num
2007-01-15 12:59:06 -04:00
" 10 " ,
2006-02-28 14:44:41 -04:00
# Str
" ' string ' " ,
# Attribute
" a.b " ,
# Subscript
" a[b:c] " ,
# Name
" v " ,
# List
" [1,2,3] " ,
2011-06-27 19:46:06 -03:00
# Empty list
" [] " ,
2006-02-28 14:44:41 -04:00
# Tuple
2006-03-01 18:49:05 -04:00
" 1,2,3 " ,
2011-06-27 19:46:06 -03:00
# Tuple
" (1,2,3) " ,
# Empty tuple
" () " ,
2006-03-01 18:49:05 -04:00
# Combination
" a.b.c.d(a.b[1:2]) " ,
2006-02-28 14:44:41 -04:00
]
# TODO: expr_context, slice, boolop, operator, unaryop, cmpop, comprehension
# excepthandler, arguments, keywords, alias
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
class AST_Tests ( unittest . TestCase ) :
2015-02-02 11:51:20 -04:00
def _assertTrueorder ( self , ast_node , parent_pos ) :
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
if not isinstance ( ast_node , ast . AST ) or ast_node . _fields is None :
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
return
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
if isinstance ( ast_node , ( ast . expr , ast . stmt , ast . excepthandler ) ) :
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
node_pos = ( ast_node . lineno , ast_node . col_offset )
2015-02-02 11:51:20 -04:00
self . assertTrue ( node_pos > = parent_pos )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
parent_pos = ( ast_node . lineno , ast_node . col_offset )
for name in ast_node . _fields :
value = getattr ( ast_node , name )
if isinstance ( value , list ) :
for child in value :
2015-02-02 11:51:20 -04:00
self . _assertTrueorder ( child , parent_pos )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
elif value is not None :
2015-02-02 11:51:20 -04:00
self . _assertTrueorder ( value , parent_pos )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
2011-06-27 19:46:06 -03:00
def test_AST_objects ( self ) :
x = ast . AST ( )
self . assertEqual ( x . _fields , ( ) )
2012-03-12 13:46:44 -03:00
x . foobar = 42
self . assertEqual ( x . foobar , 42 )
self . assertEqual ( x . __dict__ [ " foobar " ] , 42 )
2011-06-27 19:46:06 -03:00
with self . assertRaises ( AttributeError ) :
x . vararg
with self . assertRaises ( TypeError ) :
# "_ast.AST constructor takes 0 positional arguments"
ast . AST ( 2 )
2012-07-08 15:13:36 -03:00
def test_AST_garbage_collection ( self ) :
class X :
pass
a = ast . AST ( )
a . x = X ( )
a . x . a = a
ref = weakref . ref ( a . x )
del a
support . gc_collect ( )
self . assertIsNone ( ref ( ) )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
def test_snippets ( self ) :
for input , output , kind in ( ( exec_tests , exec_results , " exec " ) ,
( single_tests , single_results , " single " ) ,
( eval_tests , eval_results , " eval " ) ) :
for i , o in zip ( input , output ) :
2015-09-01 17:10:49 -03:00
with self . subTest ( action = " parsing " , input = i ) :
ast_tree = compile ( i , " ? " , kind , ast . PyCF_ONLY_AST )
self . assertEqual ( to_tuple ( ast_tree ) , o )
self . _assertTrueorder ( ast_tree , ( 0 , 0 ) )
2016-02-08 17:45:06 -04:00
with self . subTest ( action = " compiling " , input = i , kind = kind ) :
compile ( ast_tree , " ? " , kind )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
Merged revisions 73376,73393,73398,73400,73404-73405,73409,73419-73421,73432,73457,73460,73485-73486,73488-73489,73501-73502,73513-73514 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73376 | benjamin.peterson | 2009-06-11 17:29:23 -0500 (Thu, 11 Jun 2009) | 1 line
remove check for case handled in sub-function
........
r73393 | alexandre.vassalotti | 2009-06-12 13:56:57 -0500 (Fri, 12 Jun 2009) | 2 lines
Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini.
........
r73398 | alexandre.vassalotti | 2009-06-12 15:57:12 -0500 (Fri, 12 Jun 2009) | 3 lines
Add const qualifier to PyErr_SetFromErrnoWithFilename and to
PyErr_SetFromErrnoWithUnicodeFilename.
........
r73400 | alexandre.vassalotti | 2009-06-12 16:43:47 -0500 (Fri, 12 Jun 2009) | 2 lines
Delete outdated make file for building the parser with MSVC 6.
........
r73404 | benjamin.peterson | 2009-06-12 20:40:00 -0500 (Fri, 12 Jun 2009) | 1 line
keep the slice.step field as NULL if no step expression is given
........
r73405 | benjamin.peterson | 2009-06-12 22:46:30 -0500 (Fri, 12 Jun 2009) | 1 line
prevent import statements from assigning to None
........
r73409 | benjamin.peterson | 2009-06-13 08:06:21 -0500 (Sat, 13 Jun 2009) | 1 line
allow importing from a module named None if it has an 'as' clause
........
r73419 | benjamin.peterson | 2009-06-13 11:19:19 -0500 (Sat, 13 Jun 2009) | 1 line
set Print.values to NULL if there are no values
........
r73420 | benjamin.peterson | 2009-06-13 12:08:53 -0500 (Sat, 13 Jun 2009) | 1 line
give a better error message when deleting ()
........
r73421 | benjamin.peterson | 2009-06-13 15:23:33 -0500 (Sat, 13 Jun 2009) | 1 line
when no module is given in a 'from' relative import, make ImportFrom.module NULL
........
r73432 | amaury.forgeotdarc | 2009-06-14 16:20:40 -0500 (Sun, 14 Jun 2009) | 3 lines
#6227: Because of a wrong indentation, the test was not testing what it should.
Ensure that the snippet in doctest_aliases actually contains aliases.
........
r73457 | benjamin.peterson | 2009-06-16 18:13:09 -0500 (Tue, 16 Jun 2009) | 1 line
add underscores
........
r73460 | benjamin.peterson | 2009-06-16 22:23:04 -0500 (Tue, 16 Jun 2009) | 1 line
remove unused 'encoding' member from the compiler struct
........
r73485 | benjamin.peterson | 2009-06-19 17:07:47 -0500 (Fri, 19 Jun 2009) | 1 line
remove duplicate test
........
r73486 | benjamin.peterson | 2009-06-19 17:09:17 -0500 (Fri, 19 Jun 2009) | 1 line
add missing assertion #6313
........
r73488 | benjamin.peterson | 2009-06-19 17:16:28 -0500 (Fri, 19 Jun 2009) | 1 line
show that this one isn't used
........
r73489 | benjamin.peterson | 2009-06-19 17:21:12 -0500 (Fri, 19 Jun 2009) | 1 line
use closures
........
r73501 | benjamin.peterson | 2009-06-21 18:01:07 -0500 (Sun, 21 Jun 2009) | 1 line
don't need to add the name 'lambda' as assigned
........
r73502 | benjamin.peterson | 2009-06-21 18:03:36 -0500 (Sun, 21 Jun 2009) | 1 line
remove tmpname support since it's no longer used
........
r73513 | benjamin.peterson | 2009-06-22 20:18:57 -0500 (Mon, 22 Jun 2009) | 1 line
fix grammar
........
r73514 | benjamin.peterson | 2009-06-22 22:01:56 -0500 (Mon, 22 Jun 2009) | 1 line
remove some unused symtable constants
........
2009-06-28 16:19:51 -03:00
def test_slice ( self ) :
slc = ast . parse ( " x[::] " ) . body [ 0 ] . value . slice
self . assertIsNone ( slc . upper )
self . assertIsNone ( slc . lower )
self . assertIsNone ( slc . step )
def test_from_import ( self ) :
im = ast . parse ( " from . import y " ) . body [ 0 ]
self . assertIsNone ( im . module )
2012-03-22 09:19:04 -03:00
def test_non_interned_future_from_ast ( self ) :
mod = ast . parse ( " from __future__ import division " )
self . assertIsInstance ( mod . body [ 0 ] , ast . ImportFrom )
mod . body [ 0 ] . module = " __future__ " . strip ( )
compile ( mod , " <test> " , " exec " )
Merged revisions 75149,75260-75263,75265-75267,75292,75300,75376,75405,75429-75433,75437,75445,75501,75551,75572,75589-75591,75657,75742,75868,75952-75957,76057,76105,76139,76143,76162,76223 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75149 | gregory.p.smith | 2009-09-29 16:56:31 -0500 (Tue, 29 Sep 2009) | 3 lines
Mention issue6972 in extractall docs about overwriting things outside of
the supplied path.
........
r75260 | andrew.kuchling | 2009-10-05 16:24:20 -0500 (Mon, 05 Oct 2009) | 1 line
Wording fix
........
r75261 | andrew.kuchling | 2009-10-05 16:24:35 -0500 (Mon, 05 Oct 2009) | 1 line
Fix narkup
........
r75262 | andrew.kuchling | 2009-10-05 16:25:03 -0500 (Mon, 05 Oct 2009) | 1 line
Document 'skip' parameter to constructor
........
r75263 | andrew.kuchling | 2009-10-05 16:25:35 -0500 (Mon, 05 Oct 2009) | 1 line
Note side benefit of socket.create_connection()
........
r75265 | andrew.kuchling | 2009-10-05 17:31:11 -0500 (Mon, 05 Oct 2009) | 1 line
Reword sentence
........
r75266 | andrew.kuchling | 2009-10-05 17:32:48 -0500 (Mon, 05 Oct 2009) | 1 line
Use standard comma punctuation; reword some sentences in the docs
........
r75267 | andrew.kuchling | 2009-10-05 17:42:56 -0500 (Mon, 05 Oct 2009) | 1 line
Backport r73983: Document the thousands separator.
........
r75292 | benjamin.peterson | 2009-10-08 22:11:36 -0500 (Thu, 08 Oct 2009) | 1 line
death to old CVS keyword
........
r75300 | benjamin.peterson | 2009-10-09 16:48:14 -0500 (Fri, 09 Oct 2009) | 1 line
fix some coding style
........
r75376 | benjamin.peterson | 2009-10-11 20:26:07 -0500 (Sun, 11 Oct 2009) | 1 line
platform we don't care about
........
r75405 | neil.schemenauer | 2009-10-14 12:17:14 -0500 (Wed, 14 Oct 2009) | 4 lines
Issue #1754094: Improve the stack depth calculation in the compiler.
There should be no other effect than a small decrease in memory use.
Patch by Christopher Tur Lesniewski-Laas.
........
r75429 | benjamin.peterson | 2009-10-14 20:47:28 -0500 (Wed, 14 Oct 2009) | 1 line
pep8ify if blocks
........
r75430 | benjamin.peterson | 2009-10-14 20:49:37 -0500 (Wed, 14 Oct 2009) | 1 line
use floor division and add a test that exercises the tabsize codepath
........
r75431 | benjamin.peterson | 2009-10-14 20:56:25 -0500 (Wed, 14 Oct 2009) | 1 line
change test to what I intended
........
r75432 | benjamin.peterson | 2009-10-14 22:05:39 -0500 (Wed, 14 Oct 2009) | 1 line
some cleanups
........
r75433 | benjamin.peterson | 2009-10-14 22:06:55 -0500 (Wed, 14 Oct 2009) | 1 line
make inspect.isabstract() always return a boolean; add a test for it, too #7069
........
r75437 | benjamin.peterson | 2009-10-15 10:44:46 -0500 (Thu, 15 Oct 2009) | 1 line
only clear a module's __dict__ if the module is the only one with a reference to it #7140
........
r75445 | vinay.sajip | 2009-10-16 09:06:44 -0500 (Fri, 16 Oct 2009) | 1 line
Issue #7120: logging: Removed import of multiprocessing which is causing crash in GAE.
........
r75501 | antoine.pitrou | 2009-10-18 13:37:11 -0500 (Sun, 18 Oct 2009) | 3 lines
Add a comment about unreachable code, and fix a typo
........
r75551 | benjamin.peterson | 2009-10-19 22:14:10 -0500 (Mon, 19 Oct 2009) | 1 line
use property api
........
r75572 | benjamin.peterson | 2009-10-20 16:55:17 -0500 (Tue, 20 Oct 2009) | 1 line
clarify buffer arg #7178
........
r75589 | benjamin.peterson | 2009-10-21 21:26:47 -0500 (Wed, 21 Oct 2009) | 1 line
whitespace
........
r75590 | benjamin.peterson | 2009-10-21 21:36:47 -0500 (Wed, 21 Oct 2009) | 1 line
rewrite to be nice to other implementations
........
r75591 | benjamin.peterson | 2009-10-21 21:50:38 -0500 (Wed, 21 Oct 2009) | 4 lines
rewrite for style, clarify, and comments
Also, use the hasattr() like scheme of allowing BaseException exceptions through.
........
r75657 | antoine.pitrou | 2009-10-24 07:41:27 -0500 (Sat, 24 Oct 2009) | 3 lines
Fix compilation error in debug mode.
........
r75742 | benjamin.peterson | 2009-10-26 17:51:16 -0500 (Mon, 26 Oct 2009) | 1 line
use 'is' instead of id()
........
r75868 | benjamin.peterson | 2009-10-27 15:59:18 -0500 (Tue, 27 Oct 2009) | 1 line
test expect base classes
........
r75952 | georg.brandl | 2009-10-29 15:38:32 -0500 (Thu, 29 Oct 2009) | 1 line
Use the correct function name in docstring.
........
r75953 | georg.brandl | 2009-10-29 15:39:50 -0500 (Thu, 29 Oct 2009) | 1 line
Remove mention of the old -X command line switch.
........
r75954 | georg.brandl | 2009-10-29 15:53:00 -0500 (Thu, 29 Oct 2009) | 1 line
Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
........
r75955 | georg.brandl | 2009-10-29 15:54:03 -0500 (Thu, 29 Oct 2009) | 1 line
Use a single style for all the docstrings in the math module.
........
r75956 | georg.brandl | 2009-10-29 16:16:34 -0500 (Thu, 29 Oct 2009) | 1 line
I do not think the "railroad" program mentioned is still available.
........
r75957 | georg.brandl | 2009-10-29 16:44:56 -0500 (Thu, 29 Oct 2009) | 1 line
Fix constant name.
........
r76057 | benjamin.peterson | 2009-11-02 09:06:45 -0600 (Mon, 02 Nov 2009) | 1 line
prevent a rather unlikely segfault
........
r76105 | georg.brandl | 2009-11-04 01:38:12 -0600 (Wed, 04 Nov 2009) | 1 line
#7259: show correct equivalent for operator.i* operations in docstring; fix minor issues in operator docs.
........
r76139 | benjamin.peterson | 2009-11-06 19:04:38 -0600 (Fri, 06 Nov 2009) | 1 line
spelling
........
r76143 | georg.brandl | 2009-11-07 02:26:07 -0600 (Sat, 07 Nov 2009) | 1 line
#7271: fix typo.
........
r76162 | benjamin.peterson | 2009-11-08 22:10:53 -0600 (Sun, 08 Nov 2009) | 1 line
discuss how to use -p
........
r76223 | georg.brandl | 2009-11-12 02:29:46 -0600 (Thu, 12 Nov 2009) | 1 line
Give the profile module a module directive.
........
2009-11-12 22:25:08 -04:00
def test_base_classes ( self ) :
self . assertTrue ( issubclass ( ast . For , ast . stmt ) )
self . assertTrue ( issubclass ( ast . Name , ast . expr ) )
self . assertTrue ( issubclass ( ast . stmt , ast . AST ) )
self . assertTrue ( issubclass ( ast . expr , ast . AST ) )
self . assertTrue ( issubclass ( ast . comprehension , ast . AST ) )
self . assertTrue ( issubclass ( ast . Gt , ast . AST ) )
2011-06-27 19:46:06 -03:00
def test_field_attr_existence ( self ) :
for name , item in ast . __dict__ . items ( ) :
if isinstance ( item , type ) and name != ' AST ' and name [ 0 ] . isupper ( ) :
x = item ( )
if isinstance ( x , ast . AST ) :
self . assertEqual ( type ( x . _fields ) , tuple )
def test_arguments ( self ) :
x = ast . arguments ( )
2015-02-02 11:51:20 -04:00
self . assertEqual ( x . _fields , ( ' args ' , ' vararg ' , ' kwonlyargs ' ,
' kw_defaults ' , ' kwarg ' , ' defaults ' ) )
2011-06-27 19:46:06 -03:00
with self . assertRaises ( AttributeError ) :
x . vararg
2013-03-18 14:48:58 -03:00
x = ast . arguments ( * range ( 1 , 7 ) )
2011-06-27 19:46:06 -03:00
self . assertEqual ( x . vararg , 2 )
def test_field_attr_writable ( self ) :
x = ast . Num ( )
# We can assign to _fields
x . _fields = 666
self . assertEqual ( x . _fields , 666 )
def test_classattrs ( self ) :
x = ast . Num ( )
self . assertEqual ( x . _fields , ( ' n ' , ) )
with self . assertRaises ( AttributeError ) :
x . n
x = ast . Num ( 42 )
self . assertEqual ( x . n , 42 )
with self . assertRaises ( AttributeError ) :
x . lineno
with self . assertRaises ( AttributeError ) :
x . foobar
x = ast . Num ( lineno = 2 )
self . assertEqual ( x . lineno , 2 )
x = ast . Num ( 42 , lineno = 0 )
self . assertEqual ( x . lineno , 0 )
self . assertEqual ( x . _fields , ( ' n ' , ) )
self . assertEqual ( x . n , 42 )
self . assertRaises ( TypeError , ast . Num , 1 , 2 )
self . assertRaises ( TypeError , ast . Num , 1 , 2 , lineno = 0 )
def test_module ( self ) :
body = [ ast . Num ( 42 ) ]
2018-05-29 04:49:10 -03:00
x = ast . Module ( body )
2011-06-27 19:46:06 -03:00
self . assertEqual ( x . body , body )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
def test_nodeclasses ( self ) :
2011-11-11 14:35:42 -04:00
# Zero arguments constructor explicitly allowed
2011-06-27 19:46:06 -03:00
x = ast . BinOp ( )
self . assertEqual ( x . _fields , ( ' left ' , ' op ' , ' right ' ) )
# Random attribute allowed too
x . foobarbaz = 5
self . assertEqual ( x . foobarbaz , 5 )
n1 = ast . Num ( 1 )
n3 = ast . Num ( 3 )
addop = ast . Add ( )
x = ast . BinOp ( n1 , addop , n3 )
self . assertEqual ( x . left , n1 )
self . assertEqual ( x . op , addop )
self . assertEqual ( x . right , n3 )
2011-06-27 19:51:18 -03:00
2011-06-27 19:46:06 -03:00
x = ast . BinOp ( 1 , 2 , 3 )
self . assertEqual ( x . left , 1 )
self . assertEqual ( x . op , 2 )
self . assertEqual ( x . right , 3 )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
x = ast . BinOp ( 1 , 2 , 3 , lineno = 0 )
2010-11-20 15:04:17 -04:00
self . assertEqual ( x . left , 1 )
self . assertEqual ( x . op , 2 )
self . assertEqual ( x . right , 3 )
self . assertEqual ( x . lineno , 0 )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
2011-06-27 19:46:06 -03:00
# node raises exception when given too many arguments
self . assertRaises ( TypeError , ast . BinOp , 1 , 2 , 3 , 4 )
# node raises exception when given too many arguments
self . assertRaises ( TypeError , ast . BinOp , 1 , 2 , 3 , 4 , lineno = 0 )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
# can set attributes through kwargs too
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
x = ast . BinOp ( left = 1 , op = 2 , right = 3 , lineno = 0 )
2010-11-20 15:04:17 -04:00
self . assertEqual ( x . left , 1 )
self . assertEqual ( x . op , 2 )
self . assertEqual ( x . right , 3 )
self . assertEqual ( x . lineno , 0 )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
2011-06-27 19:46:06 -03:00
# Random kwargs also allowed
x = ast . BinOp ( 1 , 2 , 3 , foobarbaz = 42 )
self . assertEqual ( x . foobarbaz , 42 )
def test_no_fields ( self ) :
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
# this used to fail because Sub._fields was None
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
x = ast . Sub ( )
2011-06-27 19:46:06 -03:00
self . assertEqual ( x . _fields , ( ) )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
def test_pickling ( self ) :
import pickle
mods = [ pickle ]
try :
import cPickle
mods . append ( cPickle )
except ImportError :
pass
protocols = [ 0 , 1 , 2 ]
for mod in mods :
for protocol in protocols :
for ast in ( compile ( i , " ? " , " exec " , 0x400 ) for i in exec_tests ) :
ast2 = mod . loads ( mod . dumps ( ast , protocol ) )
2010-11-20 15:04:17 -04:00
self . assertEqual ( to_tuple ( ast2 ) , to_tuple ( ast ) )
2006-02-28 14:44:41 -04:00
2010-11-19 21:38:49 -04:00
def test_invalid_sum ( self ) :
pos = dict ( lineno = 2 , col_offset = 3 )
2018-05-29 04:49:10 -03:00
m = ast . Module ( [ ast . Expr ( ast . expr ( * * pos ) , * * pos ) ] )
2010-11-19 21:38:49 -04:00
with self . assertRaises ( TypeError ) as cm :
compile ( m , " <test> " , " exec " )
self . assertIn ( " but got <_ast.expr " , str ( cm . exception ) )
2011-07-22 12:50:23 -03:00
def test_invalid_identitifer ( self ) :
2018-05-29 04:49:10 -03:00
m = ast . Module ( [ ast . Expr ( ast . Name ( 42 , ast . Load ( ) ) ) ] )
2011-07-22 12:50:23 -03:00
ast . fix_missing_locations ( m )
with self . assertRaises ( TypeError ) as cm :
compile ( m , " <test> " , " exec " )
self . assertIn ( " identifier must be of type str " , str ( cm . exception ) )
2012-11-25 10:36:26 -04:00
def test_empty_yield_from ( self ) :
# Issue 16546: yield from value is not optional.
empty_yield_from = ast . parse ( " def f(): \n yield from g() " )
empty_yield_from . body [ 0 ] . body [ 0 ] . value . value = None
with self . assertRaises ( ValueError ) as cm :
compile ( empty_yield_from , " <test> " , " exec " )
self . assertIn ( " field value is required " , str ( cm . exception ) )
2017-09-30 14:16:24 -03:00
@support.cpython_only
def test_issue31592 ( self ) :
# There shouldn't be an assertion failure in case of a bad
# unicodedata.normalize().
import unicodedata
def bad_normalize ( * args ) :
return None
with support . swap_attr ( unicodedata , ' normalize ' , bad_normalize ) :
self . assertRaises ( TypeError , ast . parse , ' \u03D5 ' )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
class ASTHelpers_Test ( unittest . TestCase ) :
def test_parse ( self ) :
a = ast . parse ( ' foo(1 + 1) ' )
b = compile ( ' foo(1 + 1) ' , ' <unknown> ' , ' exec ' , ast . PyCF_ONLY_AST )
self . assertEqual ( ast . dump ( a ) , ast . dump ( b ) )
2012-09-02 15:23:15 -03:00
def test_parse_in_error ( self ) :
try :
1 / 0
except Exception :
2012-09-02 16:04:51 -03:00
with self . assertRaises ( SyntaxError ) as e :
ast . literal_eval ( r " ' \ U ' " )
self . assertIsNotNone ( e . exception . __context__ )
2012-09-02 15:23:15 -03:00
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
def test_dump ( self ) :
node = ast . parse ( ' spam(eggs, " and cheese " ) ' )
self . assertEqual ( ast . dump ( node ) ,
" Module(body=[Expr(value=Call(func=Name(id= ' spam ' , ctx=Load()), "
" args=[Name(id= ' eggs ' , ctx=Load()), Str(s= ' and cheese ' )], "
2018-05-29 04:49:10 -03:00
" keywords=[]))]) "
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
)
self . assertEqual ( ast . dump ( node , annotate_fields = False ) ,
" Module([Expr(Call(Name( ' spam ' , Load()), [Name( ' eggs ' , Load()), "
2018-05-29 04:49:10 -03:00
" Str( ' and cheese ' )], []))]) "
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
)
self . assertEqual ( ast . dump ( node , include_attributes = True ) ,
" Module(body=[Expr(value=Call(func=Name(id= ' spam ' , ctx=Load(), "
" lineno=1, col_offset=0), args=[Name(id= ' eggs ' , ctx=Load(), "
" lineno=1, col_offset=5), Str(s= ' and cheese ' , lineno=1, "
2015-05-05 21:16:41 -03:00
" col_offset=11)], keywords=[], "
2018-05-29 04:49:10 -03:00
" lineno=1, col_offset=0), lineno=1, col_offset=0)]) "
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
)
def test_copy_location ( self ) :
src = ast . parse ( ' 1 + 1 ' , mode = ' eval ' )
src . body . right = ast . copy_location ( ast . Num ( 2 ) , src . body . right )
self . assertEqual ( ast . dump ( src , include_attributes = True ) ,
' Expression(body=BinOp(left=Num(n=1, lineno=1, col_offset=0), '
' op=Add(), right=Num(n=2, lineno=1, col_offset=4), lineno=1, '
' col_offset=0)) '
)
def test_fix_missing_locations ( self ) :
src = ast . parse ( ' write( " spam " ) ' )
src . body . append ( ast . Expr ( ast . Call ( ast . Name ( ' spam ' , ast . Load ( ) ) ,
2015-05-05 21:16:41 -03:00
[ ast . Str ( ' eggs ' ) ] , [ ] ) ) )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
self . assertEqual ( src , ast . fix_missing_locations ( src ) )
self . assertEqual ( ast . dump ( src , include_attributes = True ) ,
" Module(body=[Expr(value=Call(func=Name(id= ' write ' , ctx=Load(), "
" lineno=1, col_offset=0), args=[Str(s= ' spam ' , lineno=1, "
2015-05-05 21:16:41 -03:00
" col_offset=6)], keywords=[], "
2015-02-02 11:51:20 -04:00
" lineno=1, col_offset=0), lineno=1, col_offset=0), "
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
" Expr(value=Call(func=Name(id= ' spam ' , ctx=Load(), lineno=1, "
" col_offset=0), args=[Str(s= ' eggs ' , lineno=1, col_offset=0)], "
2015-05-05 21:16:41 -03:00
" keywords=[], lineno=1, "
2018-05-29 04:49:10 -03:00
" col_offset=0), lineno=1, col_offset=0)]) "
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
)
def test_increment_lineno ( self ) :
src = ast . parse ( ' 1 + 1 ' , mode = ' eval ' )
self . assertEqual ( ast . increment_lineno ( src , n = 3 ) , src )
self . assertEqual ( ast . dump ( src , include_attributes = True ) ,
' Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), '
' op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, '
' col_offset=0)) '
)
2011-01-09 03:38:51 -04:00
# issue10869: do not increment lineno of root twice
2011-01-09 03:50:48 -04:00
src = ast . parse ( ' 1 + 1 ' , mode = ' eval ' )
2011-01-09 03:38:51 -04:00
self . assertEqual ( ast . increment_lineno ( src . body , n = 3 ) , src . body )
self . assertEqual ( ast . dump ( src , include_attributes = True ) ,
' Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), '
' op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, '
' col_offset=0)) '
)
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
def test_iter_fields ( self ) :
node = ast . parse ( ' foo() ' , mode = ' eval ' )
d = dict ( ast . iter_fields ( node . body ) )
self . assertEqual ( d . pop ( ' func ' ) . id , ' foo ' )
2015-05-05 21:16:41 -03:00
self . assertEqual ( d , { ' keywords ' : [ ] , ' args ' : [ ] } )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
def test_iter_child_nodes ( self ) :
node = ast . parse ( " spam(23, 42, eggs= ' leek ' ) " , mode = ' eval ' )
self . assertEqual ( len ( list ( ast . iter_child_nodes ( node . body ) ) ) , 4 )
iterator = ast . iter_child_nodes ( node . body )
self . assertEqual ( next ( iterator ) . id , ' spam ' )
self . assertEqual ( next ( iterator ) . n , 23 )
self . assertEqual ( next ( iterator ) . n , 42 )
self . assertEqual ( ast . dump ( next ( iterator ) ) ,
" keyword(arg= ' eggs ' , value=Str(s= ' leek ' )) "
)
def test_get_docstring ( self ) :
2018-06-15 05:25:13 -03:00
node = ast . parse ( ' " " " line one \n line two " " " ' )
self . assertEqual ( ast . get_docstring ( node ) ,
' line one \n line two ' )
node = ast . parse ( ' class foo: \n " " " line one \n line two " " " ' )
self . assertEqual ( ast . get_docstring ( node . body [ 0 ] ) ,
' line one \n line two ' )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
node = ast . parse ( ' def foo(): \n " " " line one \n line two " " " ' )
self . assertEqual ( ast . get_docstring ( node . body [ 0 ] ) ,
' line one \n line two ' )
2015-07-23 02:54:35 -03:00
node = ast . parse ( ' async def foo(): \n " " " spam \n ham " " " ' )
self . assertEqual ( ast . get_docstring ( node . body [ 0 ] ) , ' spam \n ham ' )
2018-06-15 05:25:13 -03:00
def test_get_docstring_none ( self ) :
2017-02-24 02:44:19 -04:00
self . assertIsNone ( ast . get_docstring ( ast . parse ( ' ' ) ) )
2018-06-15 05:25:13 -03:00
node = ast . parse ( ' x = " not docstring " ' )
self . assertIsNone ( ast . get_docstring ( node ) )
node = ast . parse ( ' def foo(): \n pass ' )
self . assertIsNone ( ast . get_docstring ( node ) )
node = ast . parse ( ' class foo: \n pass ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
node = ast . parse ( ' class foo: \n x = " not docstring " ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
node = ast . parse ( ' class foo: \n def bar(self): pass ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
node = ast . parse ( ' def foo(): \n pass ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
node = ast . parse ( ' def foo(): \n x = " not docstring " ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
node = ast . parse ( ' async def foo(): \n pass ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
node = ast . parse ( ' async def foo(): \n x = " not docstring " ' )
self . assertIsNone ( ast . get_docstring ( node . body [ 0 ] ) )
2015-07-23 02:54:35 -03:00
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
def test_literal_eval ( self ) :
self . assertEqual ( ast . literal_eval ( ' [1, 2, 3] ' ) , [ 1 , 2 , 3 ] )
self . assertEqual ( ast . literal_eval ( ' { " foo " : 42} ' ) , { " foo " : 42 } )
self . assertEqual ( ast . literal_eval ( ' (True, False, None) ' ) , ( True , False , None ) )
2010-07-11 09:59:24 -03:00
self . assertEqual ( ast . literal_eval ( ' { 1, 2, 3} ' ) , { 1 , 2 , 3 } )
2010-07-11 20:06:06 -03:00
self . assertEqual ( ast . literal_eval ( ' b " hi " ' ) , b " hi " )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
self . assertRaises ( ValueError , ast . literal_eval , ' foo() ' )
2018-01-04 05:15:39 -04:00
self . assertEqual ( ast . literal_eval ( ' 6 ' ) , 6 )
self . assertEqual ( ast . literal_eval ( ' +6 ' ) , 6 )
2010-10-07 21:47:45 -03:00
self . assertEqual ( ast . literal_eval ( ' -6 ' ) , - 6 )
self . assertEqual ( ast . literal_eval ( ' 3.25 ' ) , 3.25 )
2018-01-04 05:15:39 -04:00
self . assertEqual ( ast . literal_eval ( ' +3.25 ' ) , 3.25 )
self . assertEqual ( ast . literal_eval ( ' -3.25 ' ) , - 3.25 )
self . assertEqual ( repr ( ast . literal_eval ( ' -0.0 ' ) ) , ' -0.0 ' )
self . assertRaises ( ValueError , ast . literal_eval , ' ++6 ' )
self . assertRaises ( ValueError , ast . literal_eval , ' +True ' )
self . assertRaises ( ValueError , ast . literal_eval , ' 2+3 ' )
def test_literal_eval_complex ( self ) :
# Issue #4907
self . assertEqual ( ast . literal_eval ( ' 6j ' ) , 6 j )
self . assertEqual ( ast . literal_eval ( ' -6j ' ) , - 6 j )
self . assertEqual ( ast . literal_eval ( ' 6.75j ' ) , 6.75 j )
self . assertEqual ( ast . literal_eval ( ' -6.75j ' ) , - 6.75 j )
self . assertEqual ( ast . literal_eval ( ' 3+6j ' ) , 3 + 6 j )
self . assertEqual ( ast . literal_eval ( ' -3+6j ' ) , - 3 + 6 j )
self . assertEqual ( ast . literal_eval ( ' 3-6j ' ) , 3 - 6 j )
self . assertEqual ( ast . literal_eval ( ' -3-6j ' ) , - 3 - 6 j )
self . assertEqual ( ast . literal_eval ( ' 3.25+6.75j ' ) , 3.25 + 6.75 j )
self . assertEqual ( ast . literal_eval ( ' -3.25+6.75j ' ) , - 3.25 + 6.75 j )
self . assertEqual ( ast . literal_eval ( ' 3.25-6.75j ' ) , 3.25 - 6.75 j )
self . assertEqual ( ast . literal_eval ( ' -3.25-6.75j ' ) , - 3.25 - 6.75 j )
self . assertEqual ( ast . literal_eval ( ' (3+6j) ' ) , 3 + 6 j )
self . assertRaises ( ValueError , ast . literal_eval , ' -6j+3 ' )
self . assertRaises ( ValueError , ast . literal_eval , ' -6j+3j ' )
self . assertRaises ( ValueError , ast . literal_eval , ' 3+-6j ' )
self . assertRaises ( ValueError , ast . literal_eval , ' 3+(0+6j) ' )
self . assertRaises ( ValueError , ast . literal_eval , ' -(3+6j) ' )
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
2011-11-22 16:51:55 -04:00
def test_bad_integer ( self ) :
# issue13436: Bad error message with invalid numeric values
body = [ ast . ImportFrom ( module = ' time ' ,
names = [ ast . alias ( name = ' sleep ' ) ] ,
level = None ,
lineno = None , col_offset = None ) ]
2018-05-29 04:49:10 -03:00
mod = ast . Module ( body )
2011-11-22 16:51:55 -04:00
with self . assertRaises ( ValueError ) as cm :
compile ( mod , ' test ' , ' exec ' )
self . assertIn ( " invalid integer value: None " , str ( cm . exception ) )
2016-04-29 13:50:02 -03:00
def test_level_as_none ( self ) :
body = [ ast . ImportFrom ( module = ' time ' ,
names = [ ast . alias ( name = ' sleep ' ) ] ,
level = None ,
lineno = 0 , col_offset = 0 ) ]
2018-05-29 04:49:10 -03:00
mod = ast . Module ( body )
2016-04-29 13:50:02 -03:00
code = compile ( mod , ' test ' , ' exec ' )
ns = { }
exec ( code , ns )
self . assertIn ( ' sleep ' , ns )
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
2011-08-09 18:15:04 -03:00
class ASTValidatorTests ( unittest . TestCase ) :
def mod ( self , mod , msg = None , mode = " exec " , * , exc = ValueError ) :
mod . lineno = mod . col_offset = 0
ast . fix_missing_locations ( mod )
with self . assertRaises ( exc ) as cm :
compile ( mod , " <test> " , mode )
if msg is not None :
self . assertIn ( msg , str ( cm . exception ) )
def expr ( self , node , msg = None , * , exc = ValueError ) :
2018-05-29 04:49:10 -03:00
mod = ast . Module ( [ ast . Expr ( node ) ] )
2011-08-09 18:15:04 -03:00
self . mod ( mod , msg , exc = exc )
def stmt ( self , stmt , msg = None ) :
2018-05-29 04:49:10 -03:00
mod = ast . Module ( [ stmt ] )
2011-08-09 18:15:04 -03:00
self . mod ( mod , msg )
def test_module ( self ) :
m = ast . Interactive ( [ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] )
self . mod ( m , " must have Load context " , " single " )
m = ast . Expression ( ast . Name ( " x " , ast . Store ( ) ) )
self . mod ( m , " must have Load context " , " eval " )
def _check_arguments ( self , fac , check ) :
2013-03-18 14:48:58 -03:00
def arguments ( args = None , vararg = None ,
kwonlyargs = None , kwarg = None ,
2011-08-09 18:15:04 -03:00
defaults = None , kw_defaults = None ) :
if args is None :
args = [ ]
if kwonlyargs is None :
kwonlyargs = [ ]
if defaults is None :
defaults = [ ]
if kw_defaults is None :
kw_defaults = [ ]
2013-03-18 14:48:58 -03:00
args = ast . arguments ( args , vararg , kwonlyargs , kw_defaults ,
kwarg , defaults )
2011-08-09 18:15:04 -03:00
return fac ( args )
args = [ ast . arg ( " x " , ast . Name ( " x " , ast . Store ( ) ) ) ]
check ( arguments ( args = args ) , " must have Load context " )
check ( arguments ( kwonlyargs = args ) , " must have Load context " )
check ( arguments ( defaults = [ ast . Num ( 3 ) ] ) ,
" more positional defaults than args " )
check ( arguments ( kw_defaults = [ ast . Num ( 4 ) ] ) ,
" length of kwonlyargs is not the same as kw_defaults " )
args = [ ast . arg ( " x " , ast . Name ( " x " , ast . Load ( ) ) ) ]
check ( arguments ( args = args , defaults = [ ast . Name ( " x " , ast . Store ( ) ) ] ) ,
" must have Load context " )
args = [ ast . arg ( " a " , ast . Name ( " x " , ast . Load ( ) ) ) ,
ast . arg ( " b " , ast . Name ( " y " , ast . Load ( ) ) ) ]
check ( arguments ( kwonlyargs = args ,
kw_defaults = [ None , ast . Name ( " x " , ast . Store ( ) ) ] ) ,
" must have Load context " )
def test_funcdef ( self ) :
2013-03-18 14:48:58 -03:00
a = ast . arguments ( [ ] , None , [ ] , [ ] , None , [ ] )
2018-05-29 04:49:10 -03:00
f = ast . FunctionDef ( " x " , a , [ ] , [ ] , None )
2011-08-09 18:15:04 -03:00
self . stmt ( f , " empty body on FunctionDef " )
f = ast . FunctionDef ( " x " , a , [ ast . Pass ( ) ] , [ ast . Name ( " x " , ast . Store ( ) ) ] ,
2018-05-29 04:49:10 -03:00
None )
2011-08-09 18:15:04 -03:00
self . stmt ( f , " must have Load context " )
f = ast . FunctionDef ( " x " , a , [ ast . Pass ( ) ] , [ ] ,
2018-05-29 04:49:10 -03:00
ast . Name ( " x " , ast . Store ( ) ) )
2011-08-09 18:15:04 -03:00
self . stmt ( f , " must have Load context " )
def fac ( args ) :
2018-05-29 04:49:10 -03:00
return ast . FunctionDef ( " x " , args , [ ast . Pass ( ) ] , [ ] , None )
2011-08-09 18:15:04 -03:00
self . _check_arguments ( fac , self . stmt )
def test_classdef ( self ) :
2015-05-05 21:16:41 -03:00
def cls ( bases = None , keywords = None , body = None , decorator_list = None ) :
2011-08-09 18:15:04 -03:00
if bases is None :
bases = [ ]
if keywords is None :
keywords = [ ]
if body is None :
body = [ ast . Pass ( ) ]
if decorator_list is None :
decorator_list = [ ]
2015-05-05 21:16:41 -03:00
return ast . ClassDef ( " myclass " , bases , keywords ,
2018-05-29 04:49:10 -03:00
body , decorator_list )
2011-08-09 18:15:04 -03:00
self . stmt ( cls ( bases = [ ast . Name ( " x " , ast . Store ( ) ) ] ) ,
" must have Load context " )
self . stmt ( cls ( keywords = [ ast . keyword ( " x " , ast . Name ( " x " , ast . Store ( ) ) ) ] ) ,
" must have Load context " )
self . stmt ( cls ( body = [ ] ) , " empty body on ClassDef " )
self . stmt ( cls ( body = [ None ] ) , " None disallowed " )
self . stmt ( cls ( decorator_list = [ ast . Name ( " x " , ast . Store ( ) ) ] ) ,
" must have Load context " )
def test_delete ( self ) :
self . stmt ( ast . Delete ( [ ] ) , " empty targets on Delete " )
self . stmt ( ast . Delete ( [ None ] ) , " None disallowed " )
self . stmt ( ast . Delete ( [ ast . Name ( " x " , ast . Load ( ) ) ] ) ,
" must have Del context " )
def test_assign ( self ) :
self . stmt ( ast . Assign ( [ ] , ast . Num ( 3 ) ) , " empty targets on Assign " )
self . stmt ( ast . Assign ( [ None ] , ast . Num ( 3 ) ) , " None disallowed " )
self . stmt ( ast . Assign ( [ ast . Name ( " x " , ast . Load ( ) ) ] , ast . Num ( 3 ) ) ,
" must have Store context " )
self . stmt ( ast . Assign ( [ ast . Name ( " x " , ast . Store ( ) ) ] ,
ast . Name ( " y " , ast . Store ( ) ) ) ,
" must have Load context " )
def test_augassign ( self ) :
aug = ast . AugAssign ( ast . Name ( " x " , ast . Load ( ) ) , ast . Add ( ) ,
ast . Name ( " y " , ast . Load ( ) ) )
self . stmt ( aug , " must have Store context " )
aug = ast . AugAssign ( ast . Name ( " x " , ast . Store ( ) ) , ast . Add ( ) ,
ast . Name ( " y " , ast . Store ( ) ) )
self . stmt ( aug , " must have Load context " )
def test_for ( self ) :
x = ast . Name ( " x " , ast . Store ( ) )
y = ast . Name ( " y " , ast . Load ( ) )
p = ast . Pass ( )
self . stmt ( ast . For ( x , y , [ ] , [ ] ) , " empty body on For " )
self . stmt ( ast . For ( ast . Name ( " x " , ast . Load ( ) ) , y , [ p ] , [ ] ) ,
" must have Store context " )
self . stmt ( ast . For ( x , ast . Name ( " y " , ast . Store ( ) ) , [ p ] , [ ] ) ,
" must have Load context " )
e = ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) )
self . stmt ( ast . For ( x , y , [ e ] , [ ] ) , " must have Load context " )
self . stmt ( ast . For ( x , y , [ p ] , [ e ] ) , " must have Load context " )
def test_while ( self ) :
self . stmt ( ast . While ( ast . Num ( 3 ) , [ ] , [ ] ) , " empty body on While " )
self . stmt ( ast . While ( ast . Name ( " x " , ast . Store ( ) ) , [ ast . Pass ( ) ] , [ ] ) ,
" must have Load context " )
self . stmt ( ast . While ( ast . Num ( 3 ) , [ ast . Pass ( ) ] ,
[ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] ) ,
" must have Load context " )
def test_if ( self ) :
self . stmt ( ast . If ( ast . Num ( 3 ) , [ ] , [ ] ) , " empty body on If " )
i = ast . If ( ast . Name ( " x " , ast . Store ( ) ) , [ ast . Pass ( ) ] , [ ] )
self . stmt ( i , " must have Load context " )
i = ast . If ( ast . Num ( 3 ) , [ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] , [ ] )
self . stmt ( i , " must have Load context " )
i = ast . If ( ast . Num ( 3 ) , [ ast . Pass ( ) ] ,
[ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] )
self . stmt ( i , " must have Load context " )
def test_with ( self ) :
p = ast . Pass ( )
self . stmt ( ast . With ( [ ] , [ p ] ) , " empty items on With " )
i = ast . withitem ( ast . Num ( 3 ) , None )
self . stmt ( ast . With ( [ i ] , [ ] ) , " empty body on With " )
i = ast . withitem ( ast . Name ( " x " , ast . Store ( ) ) , None )
self . stmt ( ast . With ( [ i ] , [ p ] ) , " must have Load context " )
i = ast . withitem ( ast . Num ( 3 ) , ast . Name ( " x " , ast . Load ( ) ) )
self . stmt ( ast . With ( [ i ] , [ p ] ) , " must have Store context " )
def test_raise ( self ) :
r = ast . Raise ( None , ast . Num ( 3 ) )
self . stmt ( r , " Raise with cause but no exception " )
r = ast . Raise ( ast . Name ( " x " , ast . Store ( ) ) , None )
self . stmt ( r , " must have Load context " )
r = ast . Raise ( ast . Num ( 4 ) , ast . Name ( " x " , ast . Store ( ) ) )
self . stmt ( r , " must have Load context " )
def test_try ( self ) :
p = ast . Pass ( )
t = ast . Try ( [ ] , [ ] , [ ] , [ p ] )
self . stmt ( t , " empty body on Try " )
t = ast . Try ( [ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] , [ ] , [ ] , [ p ] )
self . stmt ( t , " must have Load context " )
t = ast . Try ( [ p ] , [ ] , [ ] , [ ] )
self . stmt ( t , " Try has neither except handlers nor finalbody " )
t = ast . Try ( [ p ] , [ ] , [ p ] , [ p ] )
self . stmt ( t , " Try has orelse but no except handlers " )
t = ast . Try ( [ p ] , [ ast . ExceptHandler ( None , " x " , [ ] ) ] , [ ] , [ ] )
self . stmt ( t , " empty body on ExceptHandler " )
e = [ ast . ExceptHandler ( ast . Name ( " x " , ast . Store ( ) ) , " y " , [ p ] ) ]
self . stmt ( ast . Try ( [ p ] , e , [ ] , [ ] ) , " must have Load context " )
e = [ ast . ExceptHandler ( None , " x " , [ p ] ) ]
t = ast . Try ( [ p ] , e , [ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] , [ p ] )
self . stmt ( t , " must have Load context " )
t = ast . Try ( [ p ] , e , [ p ] , [ ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) ) ] )
self . stmt ( t , " must have Load context " )
def test_assert ( self ) :
self . stmt ( ast . Assert ( ast . Name ( " x " , ast . Store ( ) ) , None ) ,
" must have Load context " )
assrt = ast . Assert ( ast . Name ( " x " , ast . Load ( ) ) ,
ast . Name ( " y " , ast . Store ( ) ) )
self . stmt ( assrt , " must have Load context " )
def test_import ( self ) :
self . stmt ( ast . Import ( [ ] ) , " empty names on Import " )
def test_importfrom ( self ) :
imp = ast . ImportFrom ( None , [ ast . alias ( " x " , None ) ] , - 42 )
2016-06-27 17:40:43 -03:00
self . stmt ( imp , " Negative ImportFrom level " )
2011-08-09 18:15:04 -03:00
self . stmt ( ast . ImportFrom ( None , [ ] , 0 ) , " empty names on ImportFrom " )
def test_global ( self ) :
self . stmt ( ast . Global ( [ ] ) , " empty names on Global " )
def test_nonlocal ( self ) :
self . stmt ( ast . Nonlocal ( [ ] ) , " empty names on Nonlocal " )
def test_expr ( self ) :
e = ast . Expr ( ast . Name ( " x " , ast . Store ( ) ) )
self . stmt ( e , " must have Load context " )
def test_boolop ( self ) :
b = ast . BoolOp ( ast . And ( ) , [ ] )
self . expr ( b , " less than 2 values " )
b = ast . BoolOp ( ast . And ( ) , [ ast . Num ( 3 ) ] )
self . expr ( b , " less than 2 values " )
b = ast . BoolOp ( ast . And ( ) , [ ast . Num ( 4 ) , None ] )
self . expr ( b , " None disallowed " )
b = ast . BoolOp ( ast . And ( ) , [ ast . Num ( 4 ) , ast . Name ( " x " , ast . Store ( ) ) ] )
self . expr ( b , " must have Load context " )
def test_unaryop ( self ) :
u = ast . UnaryOp ( ast . Not ( ) , ast . Name ( " x " , ast . Store ( ) ) )
self . expr ( u , " must have Load context " )
def test_lambda ( self ) :
2013-03-18 14:48:58 -03:00
a = ast . arguments ( [ ] , None , [ ] , [ ] , None , [ ] )
2011-08-09 18:15:04 -03:00
self . expr ( ast . Lambda ( a , ast . Name ( " x " , ast . Store ( ) ) ) ,
" must have Load context " )
def fac ( args ) :
return ast . Lambda ( args , ast . Name ( " x " , ast . Load ( ) ) )
self . _check_arguments ( fac , self . expr )
def test_ifexp ( self ) :
l = ast . Name ( " x " , ast . Load ( ) )
s = ast . Name ( " y " , ast . Store ( ) )
for args in ( s , l , l ) , ( l , s , l ) , ( l , l , s ) :
2011-08-09 18:17:12 -03:00
self . expr ( ast . IfExp ( * args ) , " must have Load context " )
2011-08-09 18:15:04 -03:00
def test_dict ( self ) :
d = ast . Dict ( [ ] , [ ast . Name ( " x " , ast . Load ( ) ) ] )
self . expr ( d , " same number of keys as values " )
d = ast . Dict ( [ ast . Name ( " x " , ast . Load ( ) ) ] , [ None ] )
self . expr ( d , " None disallowed " )
def test_set ( self ) :
self . expr ( ast . Set ( [ None ] ) , " None disallowed " )
s = ast . Set ( [ ast . Name ( " x " , ast . Store ( ) ) ] )
self . expr ( s , " must have Load context " )
def _check_comprehension ( self , fac ) :
self . expr ( fac ( [ ] ) , " comprehension with no generators " )
g = ast . comprehension ( ast . Name ( " x " , ast . Load ( ) ) ,
2016-09-09 14:36:01 -03:00
ast . Name ( " x " , ast . Load ( ) ) , [ ] , 0 )
2011-08-09 18:15:04 -03:00
self . expr ( fac ( [ g ] ) , " must have Store context " )
g = ast . comprehension ( ast . Name ( " x " , ast . Store ( ) ) ,
2016-09-09 14:36:01 -03:00
ast . Name ( " x " , ast . Store ( ) ) , [ ] , 0 )
2011-08-09 18:15:04 -03:00
self . expr ( fac ( [ g ] ) , " must have Load context " )
x = ast . Name ( " x " , ast . Store ( ) )
y = ast . Name ( " y " , ast . Load ( ) )
2016-09-09 14:36:01 -03:00
g = ast . comprehension ( x , y , [ None ] , 0 )
2011-08-09 18:15:04 -03:00
self . expr ( fac ( [ g ] ) , " None disallowed " )
2016-09-09 14:36:01 -03:00
g = ast . comprehension ( x , y , [ ast . Name ( " x " , ast . Store ( ) ) ] , 0 )
2011-08-09 18:15:04 -03:00
self . expr ( fac ( [ g ] ) , " must have Load context " )
def _simple_comp ( self , fac ) :
g = ast . comprehension ( ast . Name ( " x " , ast . Store ( ) ) ,
2016-09-09 14:36:01 -03:00
ast . Name ( " x " , ast . Load ( ) ) , [ ] , 0 )
2011-08-09 18:15:04 -03:00
self . expr ( fac ( ast . Name ( " x " , ast . Store ( ) ) , [ g ] ) ,
" must have Load context " )
def wrap ( gens ) :
return fac ( ast . Name ( " x " , ast . Store ( ) ) , gens )
self . _check_comprehension ( wrap )
def test_listcomp ( self ) :
self . _simple_comp ( ast . ListComp )
def test_setcomp ( self ) :
self . _simple_comp ( ast . SetComp )
def test_generatorexp ( self ) :
self . _simple_comp ( ast . GeneratorExp )
def test_dictcomp ( self ) :
g = ast . comprehension ( ast . Name ( " y " , ast . Store ( ) ) ,
2016-09-09 14:36:01 -03:00
ast . Name ( " p " , ast . Load ( ) ) , [ ] , 0 )
2011-08-09 18:15:04 -03:00
c = ast . DictComp ( ast . Name ( " x " , ast . Store ( ) ) ,
ast . Name ( " y " , ast . Load ( ) ) , [ g ] )
self . expr ( c , " must have Load context " )
c = ast . DictComp ( ast . Name ( " x " , ast . Load ( ) ) ,
ast . Name ( " y " , ast . Store ( ) ) , [ g ] )
self . expr ( c , " must have Load context " )
def factory ( comps ) :
k = ast . Name ( " x " , ast . Load ( ) )
v = ast . Name ( " y " , ast . Load ( ) )
return ast . DictComp ( k , v , comps )
self . _check_comprehension ( factory )
def test_yield ( self ) :
2012-01-14 09:58:23 -04:00
self . expr ( ast . Yield ( ast . Name ( " x " , ast . Store ( ) ) ) , " must have Load " )
self . expr ( ast . YieldFrom ( ast . Name ( " x " , ast . Store ( ) ) ) , " must have Load " )
2011-08-09 18:15:04 -03:00
def test_compare ( self ) :
left = ast . Name ( " x " , ast . Load ( ) )
comp = ast . Compare ( left , [ ast . In ( ) ] , [ ] )
self . expr ( comp , " no comparators " )
comp = ast . Compare ( left , [ ast . In ( ) ] , [ ast . Num ( 4 ) , ast . Num ( 5 ) ] )
self . expr ( comp , " different number of comparators and operands " )
comp = ast . Compare ( ast . Num ( " blah " ) , [ ast . In ( ) ] , [ left ] )
self . expr ( comp , " non-numeric " , exc = TypeError )
comp = ast . Compare ( left , [ ast . In ( ) ] , [ ast . Num ( " blah " ) ] )
self . expr ( comp , " non-numeric " , exc = TypeError )
def test_call ( self ) :
func = ast . Name ( " x " , ast . Load ( ) )
args = [ ast . Name ( " y " , ast . Load ( ) ) ]
keywords = [ ast . keyword ( " w " , ast . Name ( " z " , ast . Load ( ) ) ) ]
2015-05-05 21:16:41 -03:00
call = ast . Call ( ast . Name ( " x " , ast . Store ( ) ) , args , keywords )
2011-08-09 18:15:04 -03:00
self . expr ( call , " must have Load context " )
2015-05-05 21:16:41 -03:00
call = ast . Call ( func , [ None ] , keywords )
2011-08-09 18:15:04 -03:00
self . expr ( call , " None disallowed " )
bad_keywords = [ ast . keyword ( " w " , ast . Name ( " z " , ast . Store ( ) ) ) ]
2015-05-05 21:16:41 -03:00
call = ast . Call ( func , args , bad_keywords )
2011-08-09 18:15:04 -03:00
self . expr ( call , " must have Load context " )
def test_num ( self ) :
class subint ( int ) :
pass
class subfloat ( float ) :
pass
class subcomplex ( complex ) :
pass
for obj in " 0 " , " hello " , subint ( ) , subfloat ( ) , subcomplex ( ) :
self . expr ( ast . Num ( obj ) , " non-numeric " , exc = TypeError )
def test_attribute ( self ) :
attr = ast . Attribute ( ast . Name ( " x " , ast . Store ( ) ) , " y " , ast . Load ( ) )
self . expr ( attr , " must have Load context " )
def test_subscript ( self ) :
sub = ast . Subscript ( ast . Name ( " x " , ast . Store ( ) ) , ast . Index ( ast . Num ( 3 ) ) ,
ast . Load ( ) )
self . expr ( sub , " must have Load context " )
x = ast . Name ( " x " , ast . Load ( ) )
sub = ast . Subscript ( x , ast . Index ( ast . Name ( " y " , ast . Store ( ) ) ) ,
ast . Load ( ) )
self . expr ( sub , " must have Load context " )
s = ast . Name ( " x " , ast . Store ( ) )
for args in ( s , None , None ) , ( None , s , None ) , ( None , None , s ) :
sl = ast . Slice ( * args )
self . expr ( ast . Subscript ( x , sl , ast . Load ( ) ) ,
" must have Load context " )
sl = ast . ExtSlice ( [ ] )
self . expr ( ast . Subscript ( x , sl , ast . Load ( ) ) , " empty dims on ExtSlice " )
sl = ast . ExtSlice ( [ ast . Index ( s ) ] )
self . expr ( ast . Subscript ( x , sl , ast . Load ( ) ) , " must have Load context " )
def test_starred ( self ) :
left = ast . List ( [ ast . Starred ( ast . Name ( " x " , ast . Load ( ) ) , ast . Store ( ) ) ] ,
ast . Store ( ) )
assign = ast . Assign ( [ left ] , ast . Num ( 4 ) )
self . stmt ( assign , " must have Store context " )
def _sequence ( self , fac ) :
self . expr ( fac ( [ None ] , ast . Load ( ) ) , " None disallowed " )
self . expr ( fac ( [ ast . Name ( " x " , ast . Store ( ) ) ] , ast . Load ( ) ) ,
" must have Load context " )
def test_list ( self ) :
self . _sequence ( ast . List )
def test_tuple ( self ) :
self . _sequence ( ast . Tuple )
2012-12-06 18:41:04 -04:00
def test_nameconstant ( self ) :
self . expr ( ast . NameConstant ( 4 ) , " singleton must be True, False, or None " )
2011-08-09 18:15:04 -03:00
def test_stdlib_validates ( self ) :
stdlib = os . path . dirname ( ast . __file__ )
tests = [ fn for fn in os . listdir ( stdlib ) if fn . endswith ( " .py " ) ]
tests . extend ( [ " test/test_grammar.py " , " test/test_unpack_ex.py " ] )
for module in tests :
fn = os . path . join ( stdlib , module )
with open ( fn , " r " , encoding = " utf-8 " ) as fp :
source = fp . read ( )
2013-03-21 20:06:20 -03:00
mod = ast . parse ( source , fn )
2011-08-09 18:15:04 -03:00
compile ( mod , fn , " exec " )
2016-01-25 19:40:57 -04:00
class ConstantTests ( unittest . TestCase ) :
""" Tests on the ast.Constant node type. """
def compile_constant ( self , value ) :
tree = ast . parse ( " x = 123 " )
node = tree . body [ 0 ] . value
new_node = ast . Constant ( value = value )
ast . copy_location ( new_node , node )
tree . body [ 0 ] . value = new_node
code = compile ( tree , " <string> " , " exec " )
ns = { }
exec ( code , ns )
return ns [ ' x ' ]
2016-01-26 19:39:12 -04:00
def test_validation ( self ) :
with self . assertRaises ( TypeError ) as cm :
self . compile_constant ( [ 1 , 2 , 3 ] )
self . assertEqual ( str ( cm . exception ) ,
" got an invalid type in Constant: list " )
2016-01-25 19:40:57 -04:00
def test_singletons ( self ) :
for const in ( None , False , True , Ellipsis , b ' ' , frozenset ( ) ) :
with self . subTest ( const = const ) :
value = self . compile_constant ( const )
self . assertIs ( value , const )
def test_values ( self ) :
nested_tuple = ( 1 , )
nested_frozenset = frozenset ( { 1 } )
for level in range ( 3 ) :
nested_tuple = ( nested_tuple , 2 )
nested_frozenset = frozenset ( { nested_frozenset , 2 } )
values = ( 123 , 123.0 , 123 j ,
" unicode " , b ' bytes ' ,
tuple ( " tuple " ) , frozenset ( " frozenset " ) ,
nested_tuple , nested_frozenset )
for value in values :
with self . subTest ( value = value ) :
result = self . compile_constant ( value )
self . assertEqual ( result , value )
def test_assign_to_constant ( self ) :
tree = ast . parse ( " x = 1 " )
target = tree . body [ 0 ] . targets [ 0 ]
new_target = ast . Constant ( value = 1 )
ast . copy_location ( new_target , target )
tree . body [ 0 ] . targets [ 0 ] = new_target
with self . assertRaises ( ValueError ) as cm :
compile ( tree , " string " , " exec " )
self . assertEqual ( str ( cm . exception ) ,
" expression which can ' t be assigned "
" to in Store context " )
def test_get_docstring ( self ) :
tree = ast . parse ( " ' docstring ' \n x = 1 " )
self . assertEqual ( ast . get_docstring ( tree ) , ' docstring ' )
def get_load_const ( self , tree ) :
# Compile to bytecode, disassemble and get parameter of LOAD_CONST
# instructions
co = compile ( tree , ' <string> ' , ' exec ' )
consts = [ ]
for instr in dis . get_instructions ( co ) :
if instr . opname == ' LOAD_CONST ' :
consts . append ( instr . argval )
return consts
@support.cpython_only
def test_load_const ( self ) :
consts = [ None ,
True , False ,
124 ,
2.0 ,
3 j ,
" unicode " ,
b ' bytes ' ,
( 1 , 2 , 3 ) ]
2016-02-08 13:17:58 -04:00
code = ' \n ' . join ( [ ' x= {!r} ' . format ( const ) for const in consts ] )
code + = ' \n x = ... '
consts . extend ( ( Ellipsis , None ) )
2016-01-25 19:40:57 -04:00
tree = ast . parse ( code )
2016-02-08 13:17:58 -04:00
self . assertEqual ( self . get_load_const ( tree ) ,
consts )
2016-01-25 19:40:57 -04:00
# Replace expression nodes with constants
2016-02-08 13:17:58 -04:00
for assign , const in zip ( tree . body , consts ) :
assert isinstance ( assign , ast . Assign ) , ast . dump ( assign )
2016-01-25 19:40:57 -04:00
new_node = ast . Constant ( value = const )
2016-02-08 13:17:58 -04:00
ast . copy_location ( new_node , assign . value )
assign . value = new_node
2016-01-25 19:40:57 -04:00
2016-02-08 13:17:58 -04:00
self . assertEqual ( self . get_load_const ( tree ) ,
consts )
2016-01-25 19:40:57 -04:00
def test_literal_eval ( self ) :
tree = ast . parse ( " 1 + 2 " )
binop = tree . body [ 0 ] . value
new_left = ast . Constant ( value = 10 )
ast . copy_location ( new_left , binop . left )
binop . left = new_left
2018-01-04 05:15:39 -04:00
new_right = ast . Constant ( value = 20 j )
2016-01-25 19:40:57 -04:00
ast . copy_location ( new_right , binop . right )
binop . right = new_right
2018-01-04 05:15:39 -04:00
self . assertEqual ( ast . literal_eval ( binop ) , 10 + 20 j )
2016-01-25 19:40:57 -04:00
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
def main ( ) :
if __name__ != ' __main__ ' :
2006-03-01 18:49:05 -04:00
return
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
if sys . argv [ 1 : ] == [ ' -g ' ] :
for statements , kind in ( ( exec_tests , " exec " ) , ( single_tests , " single " ) ,
( eval_tests , " eval " ) ) :
print ( kind + " _results = [ " )
2016-02-08 12:15:21 -04:00
for statement in statements :
tree = ast . parse ( statement , " ? " , kind )
print ( " %r , " % ( to_tuple ( tree ) , ) )
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
print ( " ] " )
print ( " main() " )
raise SystemExit
2013-06-12 22:25:59 -03:00
unittest . main ( )
2006-02-28 14:44:41 -04:00
#### EVERYTHING BELOW IS GENERATED #####
exec_results = [
2018-05-29 04:49:10 -03:00
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' NameConstant ' , ( 1 , 0 ) , None ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' Str ' , ( 1 , 0 ) , ' module docstring ' ) ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' Pass ' , ( 1 , 9 ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' Expr ' , ( 1 , 9 ) , ( ' Str ' , ( 1 , 9 ) , ' function docstring ' ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ( ' arg ' , ( 1 , 6 ) , ' a ' , None ) ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' Pass ' , ( 1 , 10 ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ( ' arg ' , ( 1 , 6 ) , ' a ' , None ) ] , None , [ ] , [ ] , None , [ ( ' Num ' , ( 1 , 8 ) , 0 ) ] ) , [ ( ' Pass ' , ( 1 , 12 ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ] , ( ' arg ' , ( 1 , 7 ) , ' args ' , None ) , [ ] , [ ] , None , [ ] ) , [ ( ' Pass ' , ( 1 , 14 ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , ( ' arg ' , ( 1 , 8 ) , ' kwargs ' , None ) , [ ] ) , [ ( ' Pass ' , ( 1 , 17 ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ( ' arg ' , ( 1 , 6 ) , ' a ' , None ) , ( ' arg ' , ( 1 , 9 ) , ' b ' , None ) , ( ' arg ' , ( 1 , 14 ) , ' c ' , None ) , ( ' arg ' , ( 1 , 22 ) , ' d ' , None ) , ( ' arg ' , ( 1 , 28 ) , ' e ' , None ) ] , ( ' arg ' , ( 1 , 35 ) , ' args ' , None ) , [ ( ' arg ' , ( 1 , 41 ) , ' f ' , None ) ] , [ ( ' Num ' , ( 1 , 43 ) , 42 ) ] , ( ' arg ' , ( 1 , 49 ) , ' kwargs ' , None ) , [ ( ' Num ' , ( 1 , 11 ) , 1 ) , ( ' NameConstant ' , ( 1 , 16 ) , None ) , ( ' List ' , ( 1 , 24 ) , [ ] , ( ' Load ' , ) ) , ( ' Dict ' , ( 1 , 30 ) , [ ] , [ ] ) ] ) , [ ( ' Expr ' , ( 1 , 58 ) , ( ' Str ' , ( 1 , 58 ) , ' doc for f() ' ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' ClassDef ' , ( 1 , 0 ) , ' C ' , [ ] , [ ] , [ ( ' Pass ' , ( 1 , 8 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' ClassDef ' , ( 1 , 0 ) , ' C ' , [ ] , [ ] , [ ( ' Expr ' , ( 1 , 9 ) , ( ' Str ' , ( 1 , 9 ) , ' docstring for class C ' ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' ClassDef ' , ( 1 , 0 ) , ' C ' , [ ( ' Name ' , ( 1 , 8 ) , ' object ' , ( ' Load ' , ) ) ] , [ ] , [ ( ' Pass ' , ( 1 , 17 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' FunctionDef ' , ( 1 , 0 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' Return ' , ( 1 , 8 ) , ( ' Num ' , ( 1 , 15 ) , 1 ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' Delete ' , ( 1 , 0 ) , [ ( ' Name ' , ( 1 , 4 ) , ' v ' , ( ' Del ' , ) ) ] ) ] ) ,
( ' Module ' , [ ( ' Assign ' , ( 1 , 0 ) , [ ( ' Name ' , ( 1 , 0 ) , ' v ' , ( ' Store ' , ) ) ] , ( ' Num ' , ( 1 , 4 ) , 1 ) ) ] ) ,
( ' Module ' , [ ( ' AugAssign ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 0 ) , ' v ' , ( ' Store ' , ) ) , ( ' Add ' , ) , ( ' Num ' , ( 1 , 5 ) , 1 ) ) ] ) ,
( ' Module ' , [ ( ' For ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 4 ) , ' v ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 9 ) , ' v ' , ( ' Load ' , ) ) , [ ( ' Pass ' , ( 1 , 11 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' While ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 6 ) , ' v ' , ( ' Load ' , ) ) , [ ( ' Pass ' , ( 1 , 8 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' If ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 3 ) , ' v ' , ( ' Load ' , ) ) , [ ( ' Pass ' , ( 1 , 5 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' With ' , ( 1 , 0 ) , [ ( ' withitem ' , ( ' Name ' , ( 1 , 5 ) , ' x ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 10 ) , ' y ' , ( ' Store ' , ) ) ) ] , [ ( ' Pass ' , ( 1 , 13 ) ) ] ) ] ) ,
( ' Module ' , [ ( ' With ' , ( 1 , 0 ) , [ ( ' withitem ' , ( ' Name ' , ( 1 , 5 ) , ' x ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 10 ) , ' y ' , ( ' Store ' , ) ) ) , ( ' withitem ' , ( ' Name ' , ( 1 , 13 ) , ' z ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 18 ) , ' q ' , ( ' Store ' , ) ) ) ] , [ ( ' Pass ' , ( 1 , 21 ) ) ] ) ] ) ,
( ' Module ' , [ ( ' Raise ' , ( 1 , 0 ) , ( ' Call ' , ( 1 , 6 ) , ( ' Name ' , ( 1 , 6 ) , ' Exception ' , ( ' Load ' , ) ) , [ ( ' Str ' , ( 1 , 16 ) , ' string ' ) ] , [ ] ) , None ) ] ) ,
( ' Module ' , [ ( ' Try ' , ( 1 , 0 ) , [ ( ' Pass ' , ( 2 , 2 ) ) ] , [ ( ' ExceptHandler ' , ( 3 , 0 ) , ( ' Name ' , ( 3 , 7 ) , ' Exception ' , ( ' Load ' , ) ) , None , [ ( ' Pass ' , ( 4 , 2 ) ) ] ) ] , [ ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' Try ' , ( 1 , 0 ) , [ ( ' Pass ' , ( 2 , 2 ) ) ] , [ ] , [ ] , [ ( ' Pass ' , ( 4 , 2 ) ) ] ) ] ) ,
( ' Module ' , [ ( ' Assert ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 7 ) , ' v ' , ( ' Load ' , ) ) , None ) ] ) ,
( ' Module ' , [ ( ' Import ' , ( 1 , 0 ) , [ ( ' alias ' , ' sys ' , None ) ] ) ] ) ,
( ' Module ' , [ ( ' ImportFrom ' , ( 1 , 0 ) , ' sys ' , [ ( ' alias ' , ' v ' , None ) ] , 0 ) ] ) ,
( ' Module ' , [ ( ' Global ' , ( 1 , 0 ) , [ ' v ' ] ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' Num ' , ( 1 , 0 ) , 1 ) ) ] ) ,
( ' Module ' , [ ( ' Pass ' , ( 1 , 0 ) ) ] ) ,
( ' Module ' , [ ( ' For ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 4 ) , ' v ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 9 ) , ' v ' , ( ' Load ' , ) ) , [ ( ' Break ' , ( 1 , 11 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' For ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 4 ) , ' v ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 9 ) , ' v ' , ( ' Load ' , ) ) , [ ( ' Continue ' , ( 1 , 11 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' For ' , ( 1 , 0 ) , ( ' Tuple ' , ( 1 , 4 ) , [ ( ' Name ' , ( 1 , 4 ) , ' a ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 6 ) , ' b ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 11 ) , ' c ' , ( ' Load ' , ) ) , [ ( ' Pass ' , ( 1 , 14 ) ) ] , [ ] ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' ListComp ' , ( 1 , 1 ) , ( ' Tuple ' , ( 1 , 2 ) , [ ( ' Name ' , ( 1 , 2 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 4 ) , ' b ' , ( ' Load ' , ) ) ] , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Tuple ' , ( 1 , 11 ) , [ ( ' Name ' , ( 1 , 11 ) , ' a ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 13 ) , ' b ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 18 ) , ' c ' , ( ' Load ' , ) ) , [ ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' GeneratorExp ' , ( 1 , 1 ) , ( ' Tuple ' , ( 1 , 2 ) , [ ( ' Name ' , ( 1 , 2 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 4 ) , ' b ' , ( ' Load ' , ) ) ] , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Tuple ' , ( 1 , 11 ) , [ ( ' Name ' , ( 1 , 11 ) , ' a ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 13 ) , ' b ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 18 ) , ' c ' , ( ' Load ' , ) ) , [ ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' GeneratorExp ' , ( 1 , 1 ) , ( ' Tuple ' , ( 1 , 2 ) , [ ( ' Name ' , ( 1 , 2 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 4 ) , ' b ' , ( ' Load ' , ) ) ] , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Tuple ' , ( 1 , 12 ) , [ ( ' Name ' , ( 1 , 12 ) , ' a ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 14 ) , ' b ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 20 ) , ' c ' , ( ' Load ' , ) ) , [ ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' GeneratorExp ' , ( 2 , 4 ) , ( ' Tuple ' , ( 3 , 4 ) , [ ( ' Name ' , ( 3 , 4 ) , ' Aa ' , ( ' Load ' , ) ) , ( ' Name ' , ( 5 , 7 ) , ' Bb ' , ( ' Load ' , ) ) ] , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Tuple ' , ( 8 , 4 ) , [ ( ' Name ' , ( 8 , 4 ) , ' Aa ' , ( ' Store ' , ) ) , ( ' Name ' , ( 10 , 4 ) , ' Bb ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 10 , 10 ) , ' Cc ' , ( ' Load ' , ) ) , [ ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' DictComp ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 1 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 5 ) , ' b ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Name ' , ( 1 , 11 ) , ' w ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 16 ) , ' x ' , ( ' Load ' , ) ) , [ ] , 0 ) , ( ' comprehension ' , ( ' Name ' , ( 1 , 22 ) , ' m ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 27 ) , ' p ' , ( ' Load ' , ) ) , [ ( ' Name ' , ( 1 , 32 ) , ' g ' , ( ' Load ' , ) ) ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' DictComp ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 1 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 5 ) , ' b ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Tuple ' , ( 1 , 11 ) , [ ( ' Name ' , ( 1 , 11 ) , ' v ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 13 ) , ' w ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 18 ) , ' x ' , ( ' Load ' , ) ) , [ ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' SetComp ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 1 ) , ' r ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Name ' , ( 1 , 7 ) , ' l ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 12 ) , ' x ' , ( ' Load ' , ) ) , [ ( ' Name ' , ( 1 , 17 ) , ' g ' , ( ' Load ' , ) ) ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' SetComp ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 1 ) , ' r ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Tuple ' , ( 1 , 7 ) , [ ( ' Name ' , ( 1 , 7 ) , ' l ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 9 ) , ' m ' , ( ' Store ' , ) ) ] , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 14 ) , ' x ' , ( ' Load ' , ) ) , [ ] , 0 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' AsyncFunctionDef ' , ( 1 , 6 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' Expr ' , ( 2 , 1 ) , ( ' Str ' , ( 2 , 1 ) , ' async function ' ) ) , ( ' Expr ' , ( 3 , 1 ) , ( ' Await ' , ( 3 , 1 ) , ( ' Call ' , ( 3 , 7 ) , ( ' Name ' , ( 3 , 7 ) , ' something ' , ( ' Load ' , ) ) , [ ] , [ ] ) ) ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' AsyncFunctionDef ' , ( 1 , 6 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' AsyncFor ' , ( 2 , 7 ) , ( ' Name ' , ( 2 , 11 ) , ' e ' , ( ' Store ' , ) ) , ( ' Name ' , ( 2 , 16 ) , ' i ' , ( ' Load ' , ) ) , [ ( ' Expr ' , ( 2 , 19 ) , ( ' Num ' , ( 2 , 19 ) , 1 ) ) ] , [ ( ' Expr ' , ( 3 , 7 ) , ( ' Num ' , ( 3 , 7 ) , 2 ) ) ] ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' AsyncFunctionDef ' , ( 1 , 6 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' AsyncWith ' , ( 2 , 7 ) , [ ( ' withitem ' , ( ' Name ' , ( 2 , 12 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 2 , 17 ) , ' b ' , ( ' Store ' , ) ) ) ] , [ ( ' Expr ' , ( 2 , 20 ) , ( ' Num ' , ( 2 , 20 ) , 1 ) ) ] ) ] , [ ] , None ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' Dict ' , ( 1 , 0 ) , [ None , ( ' Num ' , ( 1 , 10 ) , 2 ) ] , [ ( ' Dict ' , ( 1 , 3 ) , [ ( ' Num ' , ( 1 , 4 ) , 1 ) ] , [ ( ' Num ' , ( 1 , 6 ) , 2 ) ] ) , ( ' Num ' , ( 1 , 12 ) , 3 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' Set ' , ( 1 , 0 ) , [ ( ' Starred ' , ( 1 , 1 ) , ( ' Set ' , ( 1 , 2 ) , [ ( ' Num ' , ( 1 , 3 ) , 1 ) , ( ' Num ' , ( 1 , 6 ) , 2 ) ] ) , ( ' Load ' , ) ) , ( ' Num ' , ( 1 , 10 ) , 3 ) ] ) ) ] ) ,
( ' Module ' , [ ( ' AsyncFunctionDef ' , ( 1 , 6 ) , ' f ' , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , [ ( ' Expr ' , ( 2 , 1 ) , ( ' ListComp ' , ( 2 , 2 ) , ( ' Name ' , ( 2 , 2 ) , ' i ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Name ' , ( 2 , 14 ) , ' b ' , ( ' Store ' , ) ) , ( ' Name ' , ( 2 , 19 ) , ' c ' , ( ' Load ' , ) ) , [ ] , 1 ) ] ) ) ] , [ ] , None ) ] ) ,
2006-02-28 14:44:41 -04:00
]
single_results = [
2006-03-01 18:49:05 -04:00
( ' Interactive ' , [ ( ' Expr ' , ( 1 , 0 ) , ( ' BinOp ' , ( 1 , 0 ) , ( ' Num ' , ( 1 , 0 ) , 1 ) , ( ' Add ' , ) , ( ' Num ' , ( 1 , 2 ) , 2 ) ) ) ] ) ,
2006-02-28 14:44:41 -04:00
]
eval_results = [
2012-12-06 18:41:04 -04:00
( ' Expression ' , ( ' NameConstant ' , ( 1 , 0 ) , None ) ) ,
2006-03-01 18:49:05 -04:00
( ' Expression ' , ( ' BoolOp ' , ( 1 , 0 ) , ( ' And ' , ) , [ ( ' Name ' , ( 1 , 0 ) , ' a ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 6 ) , ' b ' , ( ' Load ' , ) ) ] ) ) ,
( ' Expression ' , ( ' BinOp ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 0 ) , ' a ' , ( ' Load ' , ) ) , ( ' Add ' , ) , ( ' Name ' , ( 1 , 4 ) , ' b ' , ( ' Load ' , ) ) ) ) ,
( ' Expression ' , ( ' UnaryOp ' , ( 1 , 0 ) , ( ' Not ' , ) , ( ' Name ' , ( 1 , 4 ) , ' v ' , ( ' Load ' , ) ) ) ) ,
2013-03-18 14:48:58 -03:00
( ' Expression ' , ( ' Lambda ' , ( 1 , 0 ) , ( ' arguments ' , [ ] , None , [ ] , [ ] , None , [ ] ) , ( ' NameConstant ' , ( 1 , 7 ) , None ) ) ) ,
2015-09-26 02:44:43 -03:00
( ' Expression ' , ( ' Dict ' , ( 1 , 0 ) , [ ( ' Num ' , ( 1 , 2 ) , 1 ) ] , [ ( ' Num ' , ( 1 , 4 ) , 2 ) ] ) ) ,
2011-06-27 19:46:06 -03:00
( ' Expression ' , ( ' Dict ' , ( 1 , 0 ) , [ ] , [ ] ) ) ,
2015-09-26 02:44:43 -03:00
( ' Expression ' , ( ' Set ' , ( 1 , 0 ) , [ ( ' NameConstant ' , ( 1 , 1 ) , None ) ] ) ) ,
( ' Expression ' , ( ' Dict ' , ( 1 , 0 ) , [ ( ' Num ' , ( 2 , 6 ) , 1 ) ] , [ ( ' Num ' , ( 4 , 10 ) , 2 ) ] ) ) ,
2016-09-09 14:36:01 -03:00
( ' Expression ' , ( ' ListComp ' , ( 1 , 1 ) , ( ' Name ' , ( 1 , 1 ) , ' a ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Name ' , ( 1 , 7 ) , ' b ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 12 ) , ' c ' , ( ' Load ' , ) ) , [ ( ' Name ' , ( 1 , 17 ) , ' d ' , ( ' Load ' , ) ) ] , 0 ) ] ) ) ,
( ' Expression ' , ( ' GeneratorExp ' , ( 1 , 1 ) , ( ' Name ' , ( 1 , 1 ) , ' a ' , ( ' Load ' , ) ) , [ ( ' comprehension ' , ( ' Name ' , ( 1 , 7 ) , ' b ' , ( ' Store ' , ) ) , ( ' Name ' , ( 1 , 12 ) , ' c ' , ( ' Load ' , ) ) , [ ( ' Name ' , ( 1 , 17 ) , ' d ' , ( ' Load ' , ) ) ] , 0 ) ] ) ) ,
2006-03-01 18:49:05 -04:00
( ' Expression ' , ( ' Compare ' , ( 1 , 0 ) , ( ' Num ' , ( 1 , 0 ) , 1 ) , [ ( ' Lt ' , ) , ( ' Lt ' , ) ] , [ ( ' Num ' , ( 1 , 4 ) , 2 ) , ( ' Num ' , ( 1 , 8 ) , 3 ) ] ) ) ,
2015-05-05 21:16:41 -03:00
( ' Expression ' , ( ' Call ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 0 ) , ' f ' , ( ' Load ' , ) ) , [ ( ' Num ' , ( 1 , 2 ) , 1 ) , ( ' Num ' , ( 1 , 4 ) , 2 ) , ( ' Starred ' , ( 1 , 10 ) , ( ' Name ' , ( 1 , 11 ) , ' d ' , ( ' Load ' , ) ) , ( ' Load ' , ) ) ] , [ ( ' keyword ' , ' c ' , ( ' Num ' , ( 1 , 8 ) , 3 ) ) , ( ' keyword ' , None , ( ' Name ' , ( 1 , 15 ) , ' e ' , ( ' Load ' , ) ) ) ] ) ) ,
2006-12-28 02:47:50 -04:00
( ' Expression ' , ( ' Num ' , ( 1 , 0 ) , 10 ) ) ,
2006-03-01 18:49:05 -04:00
( ' Expression ' , ( ' Str ' , ( 1 , 0 ) , ' string ' ) ) ,
2015-02-02 11:51:20 -04:00
( ' Expression ' , ( ' Attribute ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 0 ) , ' a ' , ( ' Load ' , ) ) , ' b ' , ( ' Load ' , ) ) ) ,
( ' Expression ' , ( ' Subscript ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 0 ) , ' a ' , ( ' Load ' , ) ) , ( ' Slice ' , ( ' Name ' , ( 1 , 2 ) , ' b ' , ( ' Load ' , ) ) , ( ' Name ' , ( 1 , 4 ) , ' c ' , ( ' Load ' , ) ) , None ) , ( ' Load ' , ) ) ) ,
2006-03-01 18:49:05 -04:00
( ' Expression ' , ( ' Name ' , ( 1 , 0 ) , ' v ' , ( ' Load ' , ) ) ) ,
( ' Expression ' , ( ' List ' , ( 1 , 0 ) , [ ( ' Num ' , ( 1 , 1 ) , 1 ) , ( ' Num ' , ( 1 , 3 ) , 2 ) , ( ' Num ' , ( 1 , 5 ) , 3 ) ] , ( ' Load ' , ) ) ) ,
2011-06-27 19:46:06 -03:00
( ' Expression ' , ( ' List ' , ( 1 , 0 ) , [ ] , ( ' Load ' , ) ) ) ,
2006-03-01 18:49:05 -04:00
( ' Expression ' , ( ' Tuple ' , ( 1 , 0 ) , [ ( ' Num ' , ( 1 , 0 ) , 1 ) , ( ' Num ' , ( 1 , 2 ) , 2 ) , ( ' Num ' , ( 1 , 4 ) , 3 ) ] , ( ' Load ' , ) ) ) ,
2011-06-27 19:46:06 -03:00
( ' Expression ' , ( ' Tuple ' , ( 1 , 1 ) , [ ( ' Num ' , ( 1 , 1 ) , 1 ) , ( ' Num ' , ( 1 , 3 ) , 2 ) , ( ' Num ' , ( 1 , 5 ) , 3 ) ] , ( ' Load ' , ) ) ) ,
( ' Expression ' , ( ' Tuple ' , ( 1 , 0 ) , [ ] , ( ' Load ' , ) ) ) ,
2015-05-05 21:16:41 -03:00
( ' Expression ' , ( ' Call ' , ( 1 , 0 ) , ( ' Attribute ' , ( 1 , 0 ) , ( ' Attribute ' , ( 1 , 0 ) , ( ' Attribute ' , ( 1 , 0 ) , ( ' Name ' , ( 1 , 0 ) , ' a ' , ( ' Load ' , ) ) , ' b ' , ( ' Load ' , ) ) , ' c ' , ( ' Load ' , ) ) , ' d ' , ( ' Load ' , ) ) , [ ( ' Subscript ' , ( 1 , 8 ) , ( ' Attribute ' , ( 1 , 8 ) , ( ' Name ' , ( 1 , 8 ) , ' a ' , ( ' Load ' , ) ) , ' b ' , ( ' Load ' , ) ) , ( ' Slice ' , ( ' Num ' , ( 1 , 12 ) , 1 ) , ( ' Num ' , ( 1 , 14 ) , 2 ) , None ) , ( ' Load ' , ) ) ] , [ ] ) ) ,
2006-02-28 14:44:41 -04:00
]
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62048,62050-62051,62055-62066,62068-62074,62076-62078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62048 | georg.brandl | 2008-03-29 23:53:55 -0700 (Sat, 29 Mar 2008) | 2 lines
Adapt test_ast to the new ExceptHandler type.
........
r62050 | georg.brandl | 2008-03-30 00:09:22 -0700 (Sun, 30 Mar 2008) | 2 lines
Convert test_ast to unittest and add a test for r62049.
........
r62051 | georg.brandl | 2008-03-30 12:00:49 -0700 (Sun, 30 Mar 2008) | 2 lines
Make _fields attr for no fields consistent with _attributes attr.
........
r62059 | georg.brandl | 2008-03-30 13:20:39 -0700 (Sun, 30 Mar 2008) | 2 lines
Make AST nodes pickleable.
........
2008-03-31 02:29:39 -03:00
main ( )