Back to index

python3.2  3.2.2
Public Member Functions
lib2to3.tests.test_parser.TestParserIdempotency Class Reference

List of all members.

Public Member Functions

def test_all_project_files
def test_extended_unpacking

Detailed Description

A cut-down version of pytree_idempotency.py.

Definition at line 146 of file test_parser.py.


Member Function Documentation

Definition at line 150 of file test_parser.py.

00150 
00151     def test_all_project_files(self):
00152         for filepath in support.all_project_files():
00153             with open(filepath, "rb") as fp:
00154                 encoding = tokenize.detect_encoding(fp.readline)[0]
00155             self.assertTrue(encoding is not None,
00156                             "can't detect encoding for %s" % filepath)
00157             with open(filepath, "r") as fp:
00158                 source = fp.read()
00159                 source = source.decode(encoding)
00160             tree = driver.parse_string(source)
00161             new = str(tree)
00162             if encoding:
00163                 new = new.encode(encoding)
00164             if diff(filepath, new):
00165                 self.fail("Idempotency failed: %s" % filepath)

Here is the call graph for this function:

Definition at line 166 of file test_parser.py.

00166 
00167     def test_extended_unpacking(self):
00168         driver.parse_string("a, *b, c = x\n")
00169         driver.parse_string("[*a, b] = x\n")
00170         driver.parse_string("(z, *y, w) = m\n")
00171         driver.parse_string("for *z, m in d: pass\n")


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