diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2008-07-20 05:46:41 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2008-07-20 05:46:41 +0000 |
| commit | 2f49d180711ffaac7080d473b2ef86d911015e53 (patch) | |
| tree | 4b3c5dd065d257ef578dc9a3f65e1e57a21d88bb /tests | |
| parent | 55ebc2b594243063afd315311b590bef04d7b61b (diff) | |
Fixed #7441 -- Removed some of the shortcuts in the doctest output comparators, and added a wrapper to allow comparison of xml fragments. Thanks to Leo Soto for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8003 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/test_utils/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py index 9deb60b2ca..2f950bef10 100644 --- a/tests/regressiontests/test_utils/tests.py +++ b/tests/regressiontests/test_utils/tests.py @@ -29,6 +29,16 @@ r""" ... xml.endDocument() ... return stream.getvalue() +>>> def produce_xml_fragment(): +... stream = StringIO() +... xml = SimplerXMLGenerator(stream, encoding='utf-8') +... xml.startElement("foo", {"aaa" : "1.0", "bbb": "2.0"}) +... xml.characters("Hello") +... xml.endElement("foo") +... xml.startElement("bar", {}) +... xml.endElement("bar") +... return stream.getvalue() + # Long values are normalized and are comparable to normal integers ... >>> produce_long() 42 @@ -53,5 +63,10 @@ r""" >>> produce_xml() '<?xml version="1.0" encoding="UTF-8"?>\n<foo bbb="2.0" aaa="1.0"><bar ccc="3.0">Hello</bar><whiz>Goodbye</whiz></foo>' +>>> produce_xml_fragment() +'<foo aaa="1.0" bbb="2.0">Hello</foo><bar></bar>' + +>>> produce_xml_fragment() +'<foo bbb="2.0" aaa="1.0">Hello</foo><bar></bar>' """
\ No newline at end of file |
