From e26a7a8ef41f0d69951affb21655cdc2cf94a209 Mon Sep 17 00:00:00 2001
From: Jacob Walls
Date: Sun, 20 Sep 2020 10:14:54 -0400
Subject: Fixed #27906 -- Fixed test tools counting of HTML matches for subsets
of elements.
Previously examples such as '' would not match in ''.
---
tests/test_utils/tests.py | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
(limited to 'tests')
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 87e2f56979..51e3c0548a 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -768,11 +768,30 @@ class HTMLEqualTests(SimpleTestCase):
dom2 = parse_html('foo
bar
')
self.assertEqual(dom2.count(dom1), 0)
- # html with a root element contains the same html with no root element
+ # HTML with a root element contains the same HTML with no root element.
dom1 = parse_html('foo
bar
')
dom2 = parse_html('')
self.assertEqual(dom2.count(dom1), 1)
+ # Target of search is a sequence of child elements and appears more
+ # than once.
+ dom2 = parse_html('')
+ self.assertEqual(dom2.count(dom1), 2)
+
+ # Searched HTML has additional children.
+ dom1 = parse_html('')
+ dom2 = parse_html('')
+ self.assertEqual(dom2.count(dom1), 1)
+
+ # No match found in children.
+ dom1 = parse_html('')
+ self.assertEqual(dom2.count(dom1), 0)
+
+ # Target of search found among children and grandchildren.
+ dom1 = parse_html('')
+ dom2 = parse_html('')
+ self.assertEqual(dom2.count(dom1), 2)
+
def test_parsing_errors(self):
with self.assertRaises(AssertionError):
self.assertHTMLEqual('', '')
--
cgit v1.3