Back to index

python3.2  3.2.2
Public Member Functions
test_unparse.UnparseTestCase Class Reference
Inheritance diagram for test_unparse.UnparseTestCase:
Inheritance graph
[legend]
Collaboration diagram for test_unparse.UnparseTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_del_statement
def test_shifts
def test_for_else
def test_while_else
def test_unary_parens
def test_integer_parens
def test_huge_float
def test_min_int
def test_imaginary_literals
def test_lambda_parentheses
def test_chained_comparisons
def test_function_arguments
def test_relative_import
def test_nonlocal
def test_raise_from
def test_bytes
def test_annotations
def test_set_literal
def test_set_comprehension
def test_dict_comprehension
def test_class_decorators
def test_class_definition
def test_elifs
def test_try_except_finally
def assertASTEqual
def check_roundtrip

Detailed Description

Definition at line 108 of file test_unparse.py.


Member Function Documentation

def test_unparse.ASTTestCase.assertASTEqual (   self,
  ast1,
  ast2 
) [inherited]

Definition at line 97 of file test_unparse.py.

00097 
00098     def assertASTEqual(self, ast1, ast2):
00099         self.assertEqual(ast.dump(ast1), ast.dump(ast2))

Here is the call graph for this function:

Here is the caller graph for this function:

def test_unparse.ASTTestCase.check_roundtrip (   self,
  code1,
  filename = "internal" 
) [inherited]

Definition at line 100 of file test_unparse.py.

00100 
00101     def check_roundtrip(self, code1, filename="internal"):
00102         ast1 = compile(code1, filename, "exec", ast.PyCF_ONLY_AST)
00103         unparse_buffer = io.StringIO()
00104         unparse.Unparser(ast1, unparse_buffer)
00105         code2 = unparse_buffer.getvalue()
00106         ast2 = compile(code2, filename, "exec", ast.PyCF_ONLY_AST)
00107         self.assertASTEqual(ast1, ast2)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 183 of file test_unparse.py.

00183 
00184     def test_annotations(self):
00185         self.check_roundtrip("def f(a : int): pass")
00186         self.check_roundtrip("def f(a: int = 5): pass")
00187         self.check_roundtrip("def f(*args: [int]): pass")
00188         self.check_roundtrip("def f(**kwargs: dict): pass")
00189         self.check_roundtrip("def f() -> None: pass")

Here is the call graph for this function:

Definition at line 180 of file test_unparse.py.

00180 
00181     def test_bytes(self):
00182         self.check_roundtrip("b'123'")

Here is the call graph for this function:

Definition at line 153 of file test_unparse.py.

00153 
00154     def test_chained_comparisons(self):
00155         self.check_roundtrip("1 < 4 <= 5")
00156         self.check_roundtrip("a is b is c is not d")

Here is the call graph for this function:

Definition at line 199 of file test_unparse.py.

00199 
00200     def test_class_decorators(self):
00201         self.check_roundtrip(class_decorator)

Here is the call graph for this function:

Definition at line 202 of file test_unparse.py.

00202 
00203     def test_class_definition(self):
00204         self.check_roundtrip("class A(metaclass=type, *[], **{}): pass")

Here is the call graph for this function:

Definition at line 111 of file test_unparse.py.

00111 
00112     def test_del_statement(self):
00113         self.check_roundtrip("del x, y, z")

Here is the call graph for this function:

Definition at line 196 of file test_unparse.py.

00196 
00197     def test_dict_comprehension(self):
00198         self.check_roundtrip("{x: x*x for x in range(10)}")

Here is the call graph for this function:

Definition at line 205 of file test_unparse.py.

00205 
00206     def test_elifs(self):
00207         self.check_roundtrip(elif1)
00208         self.check_roundtrip(elif2)

Here is the call graph for this function:

Definition at line 118 of file test_unparse.py.

00118 
00119     def test_for_else(self):
00120         self.check_roundtrip(for_else)

Here is the call graph for this function:

Definition at line 157 of file test_unparse.py.

00157 
00158     def test_function_arguments(self):
00159         self.check_roundtrip("def f(): pass")
00160         self.check_roundtrip("def f(a): pass")
00161         self.check_roundtrip("def f(b = 2): pass")
00162         self.check_roundtrip("def f(a, b): pass")
00163         self.check_roundtrip("def f(a, b = 2): pass")
00164         self.check_roundtrip("def f(a = 5, b = 2): pass")
00165         self.check_roundtrip("def f(*, a = 1, b = 2): pass")
00166         self.check_roundtrip("def f(*, a = 1, b): pass")
00167         self.check_roundtrip("def f(*, a, b = 2): pass")
00168         self.check_roundtrip("def f(a, b = None, *, c, **kwds): pass")
00169         self.check_roundtrip("def f(a=2, *args, c=5, d, **kwds): pass")
00170         self.check_roundtrip("def f(*args, **kwargs): pass")

Here is the call graph for this function:

Definition at line 134 of file test_unparse.py.

00134 
00135     def test_huge_float(self):
00136         self.check_roundtrip("1e1000")
00137         self.check_roundtrip("-1e1000")
00138         self.check_roundtrip("1e1000j")
00139         self.check_roundtrip("-1e1000j")

Here is the call graph for this function:

Definition at line 144 of file test_unparse.py.

00144 
00145     def test_imaginary_literals(self):
00146         self.check_roundtrip("7j")
00147         self.check_roundtrip("-7j")
00148         self.check_roundtrip("0j")
00149         self.check_roundtrip("-0j")

Here is the call graph for this function:

Definition at line 131 of file test_unparse.py.

00131 
00132     def test_integer_parens(self):
00133         self.check_roundtrip("3 .__abs__()")

Here is the call graph for this function:

Definition at line 150 of file test_unparse.py.

00150 
00151     def test_lambda_parentheses(self):
00152         self.check_roundtrip("(lambda: int)()")

Here is the call graph for this function:

Definition at line 140 of file test_unparse.py.

00140 
00141     def test_min_int(self):
00142         self.check_roundtrip(str(-2**31))
00143         self.check_roundtrip(str(-2**63))

Here is the call graph for this function:

Definition at line 174 of file test_unparse.py.

00174 
00175     def test_nonlocal(self):
00176         self.check_roundtrip(nonlocal_ex)

Here is the call graph for this function:

Definition at line 177 of file test_unparse.py.

00177 
00178     def test_raise_from(self):
00179         self.check_roundtrip(raise_from)

Here is the call graph for this function:

Definition at line 171 of file test_unparse.py.

00171 
00172     def test_relative_import(self):
00173         self.check_roundtrip(relative_import)

Here is the call graph for this function:

Definition at line 193 of file test_unparse.py.

00193 
00194     def test_set_comprehension(self):
00195         self.check_roundtrip("{x for x in range(5)}")

Here is the call graph for this function:

Definition at line 190 of file test_unparse.py.

00190 
00191     def test_set_literal(self):
00192         self.check_roundtrip("{'a', 'b', 'c'}")

Here is the call graph for this function:

Definition at line 114 of file test_unparse.py.

00114 
00115     def test_shifts(self):
00116         self.check_roundtrip("45 << 2")
00117         self.check_roundtrip("13 >> 7")

Here is the call graph for this function:

Definition at line 209 of file test_unparse.py.

00209 
00210     def test_try_except_finally(self):
00211         self.check_roundtrip(try_except_finally)

Here is the call graph for this function:

Definition at line 124 of file test_unparse.py.

00124 
00125     def test_unary_parens(self):
00126         self.check_roundtrip("(-1)**7")
00127         self.check_roundtrip("(-1.)**8")
00128         self.check_roundtrip("(-1j)**6")
00129         self.check_roundtrip("not True or False")
00130         self.check_roundtrip("True or not False")

Here is the call graph for this function:

Definition at line 121 of file test_unparse.py.

00121 
00122     def test_while_else(self):
00123         self.check_roundtrip(while_else)

Here is the call graph for this function:


The documentation for this class was generated from the following file: