diff options
| author | Adam Zapletal <adamzap@gmail.com> | 2016-08-31 19:41:34 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-31 20:41:34 -0400 |
| commit | ca2ccf54ffa95cf001260b917dd267fda60e93d5 (patch) | |
| tree | 3efce67af87aeeb137b7c13b707ff90c2cff1a31 /tests/test_utils | |
| parent | ff1e7b4eb43737bf2752197036663cee58922317 (diff) | |
Fixed #24112 -- Fixed assertInHTML()'s counting if needle has no root element.
Diffstat (limited to 'tests/test_utils')
| -rw-r--r-- | tests/test_utils/tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 16c4890914..cd9b723a4e 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -591,6 +591,8 @@ class HTMLEqualTests(SimpleTestCase): self.assertIn(dom1, dom2) dom1 = parse_html('<p>bar</p>') self.assertIn(dom1, dom2) + dom1 = parse_html('<div><p>foo</p><p>bar</p></div>') + self.assertIn(dom2, dom1) def test_count(self): # equal html contains each other one time @@ -626,6 +628,11 @@ class HTMLEqualTests(SimpleTestCase): dom2 = parse_html('<p>foo<p>bar</p></p>') self.assertEqual(dom2.count(dom1), 0) + # html with a root element contains the same html with no root element + dom1 = parse_html('<p>foo</p><p>bar</p>') + dom2 = parse_html('<div><p>foo</p><p>bar</p></div>') + self.assertEqual(dom2.count(dom1), 1) + def test_parsing_errors(self): with self.assertRaises(AssertionError): self.assertHTMLEqual('<p>', '') |
