[py-svn] r32840 - in py/dist/py/xmlobj: . testing
guido at codespeak.net
guido at codespeak.net
Tue Oct 3 14:03:01 CEST 2006
Author: guido
Date: Tue Oct 3 14:03:00 2006
New Revision: 32840
Modified:
py/dist/py/xmlobj/testing/test_xml.py
py/dist/py/xmlobj/visit.py
Log:
Fixed entitizing problem in XML code.
Modified: py/dist/py/xmlobj/testing/test_xml.py
==============================================================================
--- py/dist/py/xmlobj/testing/test_xml.py (original)
+++ py/dist/py/xmlobj/testing/test_xml.py Tue Oct 3 14:03:00 2006
@@ -8,7 +8,7 @@
x = ns.hello("world")
u = unicode(x)
assert u == "<hello>world</hello>"
-
+
def test_class_identity():
assert ns.hello is ns.hello
@@ -39,3 +39,15 @@
xmlname = 'world'
u = unicode(my())
assert u == '<world/>'
+
+def test_tag_with_text_entity():
+ x = ns.hello('world & rest')
+ u = unicode(x)
+ assert u == "<hello>world & rest</hello>"
+
+def test_tag_with_text_and_attributes_entity():
+ x = ns.some(name="hello & world")
+ assert x.attr.name == "hello & world"
+ u = unicode(x)
+ assert u == '<some name="hello & world"/>'
+
Modified: py/dist/py/xmlobj/visit.py
==============================================================================
--- py/dist/py/xmlobj/visit.py (original)
+++ py/dist/py/xmlobj/visit.py Tue Oct 3 14:03:00 2006
@@ -32,7 +32,7 @@
def object(self, obj):
#self.write(obj)
- self.write(unicode(obj))
+ self.write(escape(unicode(obj)))
def list(self, obj):
assert id(obj) not in self.visited
More information about the py-svn
mailing list