MCPcopy
hub / github.com/django/django / test_html_contain

Method test_html_contain

tests/test_utils/tests.py:916–939  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

914 )
915
916 def test_html_contain(self):
917 # equal html contains each other
918 dom1 = parse_html("<p>foo")
919 dom2 = parse_html("<p>foo</p>")
920 self.assertIn(dom1, dom2)
921 self.assertIn(dom2, dom1)
922
923 dom2 = parse_html("<div><p>foo</p></div>")
924 self.assertIn(dom1, dom2)
925 self.assertNotIn(dom2, dom1)
926
927 self.assertNotIn("<p>foo</p>", dom2)
928 self.assertIn("foo", dom2)
929
930 # when a root element is used ...
931 dom1 = parse_html("<p>foo</p><p>bar</p>")
932 dom2 = parse_html("<p>foo</p><p>bar</p>")
933 self.assertIn(dom1, dom2)
934 dom1 = parse_html("<p>foo</p>")
935 self.assertIn(dom1, dom2)
936 dom1 = parse_html("<p>bar</p>")
937 self.assertIn(dom1, dom2)
938 dom1 = parse_html("<div><p>foo</p><p>bar</p></div>")
939 self.assertIn(dom2, dom1)
940
941 def test_count(self):
942 # equal html contains each other one time

Callers

nothing calls this directly

Calls 1

parse_htmlFunction · 0.90

Tested by

no test coverage detected