From ca2ccf54ffa95cf001260b917dd267fda60e93d5 Mon Sep 17 00:00:00 2001
From: Adam Zapletal
Date: Wed, 31 Aug 2016 19:41:34 -0500
Subject: Fixed #24112 -- Fixed assertInHTML()'s counting if needle has no root
element.
---
tests/test_utils/tests.py | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'tests')
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('bar
')
self.assertIn(dom1, dom2)
+ dom1 = parse_html('')
+ 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('foo
bar
')
self.assertEqual(dom2.count(dom1), 0)
+ # 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)
+
def test_parsing_errors(self):
with self.assertRaises(AssertionError):
self.assertHTMLEqual('', '')
--
cgit v1.3