Back to index

plone3  3.1.7
Public Member Functions
GenericSetup.tests.test_utils.PrettyDocumentTests Class Reference

List of all members.

Public Member Functions

def test_attr_quoting
def test_text_quoting

Detailed Description

Definition at line 520 of file test_utils.py.


Member Function Documentation

Definition at line 522 of file test_utils.py.

00522 
00523     def test_attr_quoting(self):
00524         original = 'baz &nbsp;<bar>&"\''
00525         expected = ('<?xml version="1.0"?>\n'
00526                     '<doc foo="baz &amp;nbsp;&lt;bar&gt;&amp;&quot;\'"/>\n')
00527 
00528         doc = PrettyDocument()
00529         node = doc.createElement('doc')
00530         node.setAttribute('foo', original)
00531         doc.appendChild(node)
00532         self.assertEqual(doc.toprettyxml(' '), expected)
00533         # Reparse
00534         e = parseString(expected).documentElement
00535         self.assertEqual(e.getAttribute('foo'), original)

Definition at line 536 of file test_utils.py.

00536 
00537     def test_text_quoting(self):
00538         original = 'goo &nbsp;<hmm>&"\''
00539         expected = ('<?xml version="1.0"?>\n'
00540                     '<doc>goo &amp;nbsp;&lt;hmm&gt;&amp;"\'</doc>\n')
00541 
00542         doc = PrettyDocument()
00543         node = doc.createElement('doc')
00544         child = doc.createTextNode(original)
00545         node.appendChild(child)
00546         doc.appendChild(node)
00547         self.assertEqual(doc.toprettyxml(' '), expected)
00548         # Reparse
00549         e = parseString(expected).documentElement
00550         self.assertEqual(e.childNodes[0].nodeValue, original)
00551 


The documentation for this class was generated from the following file: