Back to index

python3.2  3.2.2
Classes | Functions | Variables
test_unparse Namespace Reference

Classes

class  ASTTestCase
class  UnparseTestCase
class  DirectoryTestCase

Functions

def read_pyfile
def test_main

Variables

string for_else
string while_else
string relative_import
string nonlocal_ex
string raise_from
string class_decorator
string elif1
string elif2
string try_except_finally

Function Documentation

def test_unparse.read_pyfile (   filename)
Read and return the contents of a Python source file (as a
string), taking into account the file encoding.

Definition at line 9 of file test_unparse.py.

00009 
00010 def read_pyfile(filename):
00011     """Read and return the contents of a Python source file (as a
00012     string), taking into account the file encoding."""
00013     with open(filename, "rb") as pyfile:
00014         encoding = tokenize.detect_encoding(pyfile.readline)[0]
00015     with open(filename, "r", encoding=encoding) as pyfile:
00016         source = pyfile.read()
00017     return source

Here is the caller graph for this function:

Definition at line 236 of file test_unparse.py.

00236 
00237 def test_main():
00238     test.support.run_unittest(UnparseTestCase, DirectoryTestCase)

Here is the call graph for this function:


Variable Documentation

Initial value:
00001 """\
00002 @f1(arg)
00003 @f2
00004 class Foo: pass
00005 """

Definition at line 61 of file test_unparse.py.

Initial value:
00001 """\
00002 if cond1:
00003     suite1
00004 elif cond2:
00005     suite2
00006 else:
00007     suite3
00008 """

Definition at line 67 of file test_unparse.py.

Initial value:
00001 """\
00002 if cond1:
00003     suite1
00004 elif cond2:
00005     suite2
00006 """

Definition at line 76 of file test_unparse.py.

Initial value:
00001 """\
00002 def f():
00003     for x in range(10):
00004         break
00005     else:
00006         y = 2
00007     z = 3
00008 """

Definition at line 18 of file test_unparse.py.

Initial value:
00001 """\
00002 def f():
00003     x = 1
00004     def g():
00005         nonlocal x
00006         x = 2
00007         y = 7
00008         def h():
00009             nonlocal x, y
00010 """

Definition at line 42 of file test_unparse.py.

Initial value:
00001 """\
00002 try:
00003     1 / 0
00004 except ZeroDivisionError as e:
00005     raise ArithmeticError from e
00006 """

Definition at line 54 of file test_unparse.py.

Initial value:
00001 """\
00002 from . import fred
00003 from .. import barney
00004 from .australia import shrimp as prawns
00005 """

Definition at line 36 of file test_unparse.py.

Initial value:
00001 """\
00002 try:
00003     suite1
00004 except ex1:
00005     suite2
00006 except ex2:
00007     suite3
00008 else:
00009     suite4
00010 finally:
00011     suite5
00012 """

Definition at line 83 of file test_unparse.py.

Initial value:
00001 """\
00002 def g():
00003     while True:
00004         break
00005     else:
00006         y = 2
00007     z = 3
00008 """

Definition at line 27 of file test_unparse.py.