1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #25170 -- Made assertXMLEqual()/assertXMLNotEqual() ignore leading and trailing whitespace.

Thanks Jacek Bzdak for indepdently contributing a similar fix.
This commit is contained in:
Mattia Larentis
2015-11-07 14:31:25 +01:00
committed by Tim Graham
parent 7862cbda86
commit 2085d8d5bc
3 changed files with 15 additions and 3 deletions

View File

@@ -753,6 +753,16 @@ class XMLEqualTests(SimpleTestCase):
xml2 = "<?xml version='1.0'?><!-- comment2 --><elem attr2='b' attr1='a' />"
self.assertXMLEqual(xml1, xml2)
def test_simple_equal_with_leading_or_trailing_whitespace(self):
xml1 = "<elem>foo</elem> \t\n"
xml2 = " \t\n<elem>foo</elem>"
self.assertXMLEqual(xml1, xml2)
def test_simple_not_equal_with_whitespace_in_the_middle(self):
xml1 = "<elem>foo</elem><elem>bar</elem>"
xml2 = "<elem>foo</elem> <elem>bar</elem>"
self.assertXMLNotEqual(xml1, xml2)
class SkippingExtraTests(TestCase):
fixtures = ['should_not_be_loaded.json']