mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #24112 -- Fixed assertInHTML()'s counting if needle has no root element.
This commit is contained in:
parent
ff1e7b4eb4
commit
ca2ccf54ff
2 changed files with 10 additions and 0 deletions
|
@ -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>', '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue