diff options
author | Fred Drake <fdrake@acm.org> | 2000-09-23 04:47:56 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-09-23 04:47:56 (GMT) |
commit | 7fbc85c5c541323f78730b051aae8af07a0a25a6 (patch) | |
tree | 6dcc34d62aaeb0333bfc8d9e420e38acd2f91346 /Lib/test/test_pyexpat.py | |
parent | 003b9250e3aaf8fc243f870702f430cebf9bb2ce (diff) | |
download | cpython-7fbc85c5c541323f78730b051aae8af07a0a25a6.zip cpython-7fbc85c5c541323f78730b051aae8af07a0a25a6.tar.gz cpython-7fbc85c5c541323f78730b051aae8af07a0a25a6.tar.bz2 |
Rename the public interface from "pyexpat" to "xml.parsers.expat".
Diffstat (limited to 'Lib/test/test_pyexpat.py')
-rw-r--r-- | Lib/test/test_pyexpat.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py index 9c31671..a119987 100644 --- a/Lib/test/test_pyexpat.py +++ b/Lib/test/test_pyexpat.py @@ -3,7 +3,7 @@ # XXX TypeErrors on calling handlers, or on bad return values from a # handler, are obscure and unhelpful. -import pyexpat +from xml.parsers import expat class Outputter: def StartElementHandler(self, name, attrs): @@ -67,7 +67,7 @@ def confirm(ok): print "Not OK." out = Outputter() -parser = pyexpat.ParserCreate(namespace_separator='!') +parser = expat.ParserCreate(namespace_separator='!') # Test getting/setting returns_unicode parser.returns_unicode = 0; confirm(parser.returns_unicode == 0) @@ -115,28 +115,28 @@ data = '''\ parser.returns_unicode = 0 try: parser.Parse(data, 1) -except pyexpat.error: - print '** Error', parser.ErrorCode, pyexpat.ErrorString(parser.ErrorCode) +except expat.error: + print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) print '** Line', parser.ErrorLineNumber print '** Column', parser.ErrorColumnNumber print '** Byte', parser.ErrorByteIndex # Try the parse again, this time producing Unicode output -parser = pyexpat.ParserCreate(namespace_separator='!') +parser = expat.ParserCreate(namespace_separator='!') parser.returns_unicode = 1 for name in HANDLER_NAMES: setattr(parser, name, getattr(out, name)) try: parser.Parse(data, 1) -except pyexpat.error: - print '** Error', parser.ErrorCode, pyexpat.ErrorString(parser.ErrorCode) +except expat.error: + print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) print '** Line', parser.ErrorLineNumber print '** Column', parser.ErrorColumnNumber print '** Byte', parser.ErrorByteIndex # Try parsing a file -parser = pyexpat.ParserCreate(namespace_separator='!') +parser = expat.ParserCreate(namespace_separator='!') parser.returns_unicode = 1 for name in HANDLER_NAMES: @@ -145,8 +145,8 @@ import StringIO file = StringIO.StringIO(data) try: parser.ParseFile(file) -except pyexpat.error: - print '** Error', parser.ErrorCode, pyexpat.ErrorString(parser.ErrorCode) +except expat.error: + print '** Error', parser.ErrorCode, expat.ErrorString(parser.ErrorCode) print '** Line', parser.ErrorLineNumber print '** Column', parser.ErrorColumnNumber print '** Byte', parser.ErrorByteIndex |