diff options
author | Fred Drake <fdrake@acm.org> | 2006-07-29 16:56:15 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2006-07-29 16:56:15 (GMT) |
commit | fbdeaad06910a50d6f05da177949b9a451a1132a (patch) | |
tree | 373bae36b9be6328bc02c6f2a778e76a2f58e7ea /Lib/test/test_xml_etree.py | |
parent | c032ee939bae3662017f6ff359fb1ed7d207f3f6 (diff) | |
download | cpython-fbdeaad06910a50d6f05da177949b9a451a1132a.zip cpython-fbdeaad06910a50d6f05da177949b9a451a1132a.tar.gz cpython-fbdeaad06910a50d6f05da177949b9a451a1132a.tar.bz2 |
expunge the xmlcore changes:
41667, 41668 - initial switch to xmlcore
47044 - mention of xmlcore in What's New
50687 - mention of xmlcore in the library reference
re-apply xmlcore changes to xml:
41674 - line ending changes (re-applied manually), directory props
41677 - add cElementTree wrapper
41678 - PSF licensing for etree
41812 - whitespace normalization
42724 - fix svn:eol-style settings
43681, 43682 - remove Python version-compatibility cruft from minidom
46773 - fix encoding of \r\n\t in attr values in saxutils
47269 - added XMLParser alias for cElementTree compatibility
additional tests were added in Lib/test/test_sax.py that failed with
the xmlcore changes; these relate to SF bugs #1511497, #1513611
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r-- | Lib/test/test_xml_etree.py | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 86052d7..1e8aa2d 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1,4 +1,4 @@ -# xmlcore.etree test. This file contains enough tests to make sure that +# xml.etree test. This file contains enough tests to make sure that # all included components work as they should. For a more extensive # test suite, see the selftest script in the ElementTree distribution. @@ -6,8 +6,6 @@ import doctest, sys from test import test_support -from xmlcore.etree import ElementTree as ET - SAMPLE_XML = """ <body> <tag>text</tag> @@ -32,9 +30,9 @@ def sanity(): """ Import sanity. - >>> from xmlcore.etree import ElementTree - >>> from xmlcore.etree import ElementInclude - >>> from xmlcore.etree import ElementPath + >>> from xml.etree import ElementTree + >>> from xml.etree import ElementInclude + >>> from xml.etree import ElementPath """ def check_method(method): @@ -61,6 +59,8 @@ def interface(): """ Test element tree interface. + >>> from xml.etree import ElementTree as ET + >>> element = ET.Element("tag", key="value") >>> tree = ET.ElementTree(element) @@ -108,6 +108,8 @@ def find(): """ Test find methods (including xpath syntax). + >>> from xml.etree import ElementTree as ET + >>> elem = ET.XML(SAMPLE_XML) >>> elem.find("tag").tag 'tag' @@ -174,6 +176,8 @@ def find(): def parseliteral(): r""" + >>> from xml.etree import ElementTree as ET + >>> element = ET.XML("<html><body>text</body></html>") >>> ET.ElementTree(element).write(sys.stdout) <html><body>text</body></html> @@ -195,19 +199,6 @@ def parseliteral(): 'body' """ -def check_encoding(encoding): - """ - >>> check_encoding("ascii") - >>> check_encoding("us-ascii") - >>> check_encoding("iso-8859-1") - >>> check_encoding("iso-8859-15") - >>> check_encoding("cp437") - >>> check_encoding("mac-roman") - """ - ET.XML( - "<?xml version='1.0' encoding='%s'?><xml />" % encoding - ) - # # xinclude tests (samples from appendix C of the xinclude specification) @@ -282,14 +273,16 @@ def xinclude_loader(href, parse="xml", encoding=None): except KeyError: raise IOError("resource not found") if parse == "xml": - return ET.XML(data) + from xml.etree.ElementTree import XML + return XML(data) return data def xinclude(): r""" Basic inclusion example (XInclude C.1) - >>> from xmlcore.etree import ElementInclude + >>> from xml.etree import ElementTree as ET + >>> from xml.etree import ElementInclude >>> document = xinclude_loader("C1.xml") >>> ElementInclude.include(document, xinclude_loader) |