Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cfe22392
Commit
cfe22392
authored
Dec 22, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New test function by Sjoerd, adding -t option.
parent
37cfd03a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
9 deletions
+24
-9
Lib/xmllib.py
Lib/xmllib.py
+24
-9
No files found.
Lib/xmllib.py
View file @
cfe22392
...
...
@@ -795,16 +795,20 @@ class TestXMLParser(XMLParser):
self
.
flush
()
def
test
(
args
=
None
):
import
sys
import
sys
,
getopt
from
time
import
time
if
not
args
:
args
=
sys
.
argv
[
1
:]
if
args
and
args
[
0
]
==
'-s'
:
args
=
args
[
1
:]
klass
=
XMLParser
else
:
klass
=
TestXMLParser
opts
,
args
=
getopt
.
getopt
(
args
,
'st'
)
klass
=
TestXMLParser
do_time
=
0
for
o
,
a
in
opts
:
if
o
==
'-s'
:
klass
=
XMLParser
elif
o
==
'-t'
:
do_time
=
1
if
args
:
file
=
args
[
0
]
...
...
@@ -825,13 +829,24 @@ def test(args = None):
f
.
close
()
x
=
klass
()
t0
=
time
()
try
:
for
c
in
data
:
x
.
feed
(
c
)
x
.
close
()
if
do_time
:
x
.
feed
(
data
)
x
.
close
()
else
:
for
c
in
data
:
x
.
feed
(
c
)
x
.
close
()
except
RuntimeError
,
msg
:
t1
=
time
()
print
msg
if
do_time
:
print
'total time: %g'
%
(
t1
-
t0
)
sys
.
exit
(
1
)
t1
=
time
()
if
do_time
:
print
'total time: %g'
%
(
t1
-
t0
)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment