Back to index

python3.2  3.2.2
Classes | Functions
lib2to3.tests.test_parser Namespace Reference

Classes

class  GrammarTest
class  TestRaiseChanges
class  TestFunctionAnnotations
class  TestExcept
class  TestSetLiteral
class  TestNumericLiterals
class  TestClassDef
class  TestParserIdempotency
class  TestLiterals

Functions

def diff

Detailed Description

Test suite for 2to3's parser and grammar files.

This is the place to add tests for changes to 2to3's grammar, such as those
merging the grammars for Python 2 and 3. In addition to specific tests for
parts of the grammar we've changed, we also make sure we can parse the
test_grammar.py files from both Python 2 and Python 3.

Function Documentation

def lib2to3.tests.test_parser.diff (   fn,
  result,
  encoding 
)

Definition at line 205 of file test_parser.py.

00205 
00206 def diff(fn, result, encoding):
00207     f = open("@", "w")
00208     try:
00209         f.write(result.encode(encoding))
00210     finally:
00211         f.close()
00212     try:
00213         fn = fn.replace('"', '\\"')
00214         return os.system('diff -u "%s" @' % fn)
00215     finally:
00216         os.remove("@")