Skip to content

Commit 812be4c

Browse files
committed
now move stuff from simple_parser.py to parse.py and be done with it...
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40284
1 parent a823777 commit 812be4c

2 files changed

Lines changed: 19 additions & 38 deletions

File tree

tests/parse.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1+
import sys
2+
import os
13

24
from test_parser import *
3-
import sys, os
45

56
os.chdir(os.path.split(os.path.abspath(__file__))[0])
67
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
7-
8-
98
import parser
109

1110
if __name__ == "__main__":
12-
x = ""
11+
p = parser.HTMLParser()
1312
if len(sys.argv) > 1:
1413
x = sys.argv[1]
14+
if len(sys.argv) > 2:
15+
import hotshot
16+
import hotshot.stats
17+
prof = hotshot.Profile('stats.prof')
18+
prof.runcall(p.parse, x, False)
19+
prof.close()
20+
stats = hotshot.stats.load('stats.prof')
21+
stats.strip_dirs()
22+
stats.sort_stats('time')
23+
stats.print_stats()
24+
else:
25+
document = p.parse(x)
26+
print convertTreeDump(document.printTree())
1527
else:
16-
x = "x"
17-
p = parser.HTMLParser()
18-
document = p.parse(StringIO.StringIO(x))
19-
print convertTreeDump(document.printTree())
28+
print """Pass one argument to parse the document and two to get an
29+
indication on what's going on.
30+
"""

tests/simple_parser.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)