summaryrefslogtreecommitdiff
path: root/tests/test_utils
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-05-09 06:55:32 -0700
committerCarlton Gibson <carlton.gibson@noumenal.es>2019-05-09 15:55:32 +0200
commit48235ba807483fe349d2dc66aaeddc0d03f8b0d4 (patch)
tree1004a9f7399e7d1363b38f79f8cb1929835db9af /tests/test_utils
parentaf5ec222ccd24e81f9fec6c34836a4e503e7ccf7 (diff)
Refs #30399 -- Made assertHTMLEqual normalize character and entity references.
Diffstat (limited to 'tests/test_utils')
-rw-r--r--tests/test_utils/tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 69a99d47d2..5b84bbd383 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -612,6 +612,31 @@ class HTMLEqualTests(SimpleTestCase):
'<input type="text" id="id_name" />',
'<input type="password" id="id_name" />')
+ def test_normalize_refs(self):
+ pairs = [
+ ('&#39;', '&#x27;'),
+ ('&#39;', "'"),
+ ('&#x27;', '&#39;'),
+ ('&#x27;', "'"),
+ ("'", '&#39;'),
+ ("'", '&#x27;'),
+ ('&amp;', '&#38;'),
+ ('&amp;', '&#x26;'),
+ ('&amp;', '&'),
+ ('&#38;', '&amp;'),
+ ('&#38;', '&#x26;'),
+ ('&#38;', '&'),
+ ('&#x26;', '&amp;'),
+ ('&#x26;', '&#38;'),
+ ('&#x26;', '&'),
+ ('&', '&amp;'),
+ ('&', '&#38;'),
+ ('&', '&#x26;'),
+ ]
+ for pair in pairs:
+ with self.subTest(repr(pair)):
+ self.assertHTMLEqual(*pair)
+
def test_complex_examples(self):
self.assertHTMLEqual(
"""<tr><th><label for="id_first_name">First name:</label></th>