diff options
| author | scoder <none@none> | 2007-05-11 19:01:49 +0200 |
|---|---|---|
| committer | scoder <none@none> | 2007-05-11 19:01:49 +0200 |
| commit | 80a71f8f30c42929b05ed7a72e4c414d788fdb9e (patch) | |
| tree | 3e1b2fb27db8fe2c4b7cba4c8fe3c918b89a5c39 /selftest.py | |
| parent | fb11da508b4ccb3d48bff10bc29b6166765ef436 (diff) | |
| download | python-lxml-80a71f8f30c42929b05ed7a72e4c414d788fdb9e.tar.gz | |
[svn r2287] enabled some more ET selftests (rest is broken due to different serialisation)
--HG--
branch : trunk
Diffstat (limited to 'selftest.py')
| -rw-r--r-- | selftest.py | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/selftest.py b/selftest.py index d2ebb36d..ae36fa6c 100644 --- a/selftest.py +++ b/selftest.py @@ -272,28 +272,31 @@ def parsefile(): ## '<p>spam<b>egg</b></p>' ## """ -## def parseliteral(): -## r""" -## >>> element = ElementTree.XML("<html><body>text</body></html>") -## >>> ElementTree.ElementTree(element).write(sys.stdout) -## <html><body>text</body></html> -## >>> element = ElementTree.fromstring("<html><body>text</body></html>") -## >>> ElementTree.ElementTree(element).write(sys.stdout) -## <html><body>text</body></html> -## >>> print ElementTree.tostring(element) -## <html><body>text</body></html> -## >>> print ElementTree.tostring(element, "ascii") -## <?xml version='1.0' encoding='ascii'?> -## <html><body>text</body></html> -## >>> _, ids = ElementTree.XMLID("<html><body>text</body></html>") -## >>> len(ids) -## 0 -## >>> _, ids = ElementTree.XMLID("<html><body id='body'>text</body></html>") -## >>> len(ids) -## 1 -## >>> ids["body"].tag -## 'body' -## """ +def parseliteral(): + r""" + >>> element = ElementTree.XML("<html><body>text</body></html>") + >>> ElementTree.ElementTree(element).write(sys.stdout) + <html><body>text</body></html> + >>> element = ElementTree.fromstring("<html><body>text</body></html>") + >>> ElementTree.ElementTree(element).write(sys.stdout) + <html><body>text</body></html> + >>> print ElementTree.tostring(element) + <html><body>text</body></html> + +# looks different in lxml +# >>> print ElementTree.tostring(element, "ascii") +# <?xml version='1.0' encoding='ascii'?> +# <html><body>text</body></html> + + >>> _, ids = ElementTree.XMLID("<html><body>text</body></html>") + >>> len(ids) + 0 + >>> _, ids = ElementTree.XMLID("<html><body id='body'>text</body></html>") + >>> len(ids) + 1 + >>> ids["body"].tag + 'body' + """ ## def simpleparsefile(): ## """ @@ -519,16 +522,18 @@ ENTITY_XML = """\ ## """ -## def xmllang(): -## """ -## This appears to be a problem; in underlying libxml2? +def xmllang(): + """ + This appears to be a problem; in underlying libxml2? -## 1) xml namespace + 1) xml namespace -## >>> elem = ElementTree.XML("<tag xml:lang='en' />") -## >>> serialize(elem) # 1.1 -## '<tag xml:lang="en" />' -## """ + >>> elem = ElementTree.XML("<tag xml:lang='en' />") + >>> serialize(elem) # 1.1 + '<tag xml:lang="en"/>' + +# '<tag xml:lang="en" />' # ElementTree produces an extra blank + """ def namespace(): """ |
