X7ROOT File Manager
Current Path:
/lib64/python2.7/Demo/parser
lib64
/
python2.7
/
Demo
/
parser
/
??
..
??
FILES
(91 B)
??
README
(1.01 KB)
??
docstring.py
(27 B)
??
docstring.pyc
(175 B)
??
docstring.pyo
(175 B)
??
example.py
(5.59 KB)
??
example.pyc
(7.04 KB)
??
example.pyo
(7.04 KB)
??
simple.py
(29 B)
??
simple.pyc
(279 B)
??
simple.pyo
(279 B)
??
source.py
(741 B)
??
source.pyc
(1.55 KB)
??
source.pyo
(1.55 KB)
??
test_parser.py
(1.16 KB)
??
test_parser.pyc
(1.41 KB)
??
test_parser.pyo
(1.41 KB)
??
test_unparse.py
(5.44 KB)
??
test_unparse.pyc
(8.45 KB)
??
test_unparse.pyo
(8.45 KB)
??
unparse.py
(16.85 KB)
??
unparse.pyc
(23.44 KB)
??
unparse.pyo
(23.36 KB)
Editing: test_parser.py
#! /usr/bin/python2.7 # (Force the script to use the latest build.) # # test_parser.py import parser, traceback _numFailed = 0 def testChunk(t, fileName): global _numFailed print '----', fileName, try: st = parser.suite(t) tup = parser.st2tuple(st) # this discards the first ST; a huge memory savings when running # against a large source file like Tkinter.py. st = None new = parser.tuple2st(tup) except parser.ParserError, err: print print 'parser module raised exception on input file', fileName + ':' traceback.print_exc() _numFailed = _numFailed + 1 else: if tup != parser.st2tuple(new): print print 'parser module failed on input file', fileName _numFailed = _numFailed + 1 else: print 'o.k.' def testFile(fileName): t = open(fileName).read() testChunk(t, fileName) def test(): import sys args = sys.argv[1:] if not args: import glob args = glob.glob("*.py") args.sort() map(testFile, args) sys.exit(_numFailed != 0) if __name__ == '__main__': test()
Upload File
Create Folder