MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / test_reduce_html_reduction_2

Function test_reduce_html_reduction_2

tests/test_cleanup_html.py:120–139  ·  view source on GitHub ↗

Test reduce_html at reduction level 2 (further reducing text content and decomposing style tags).

()

Source from the content-addressed store, hash-verified

118
119
120def test_reduce_html_reduction_2():
121 """Test reduce_html at reduction level 2 (further reducing text content and decomposing style tags)."""
122 raw_html = """
123 <html>
124 <head>
125 <style>.unused { color: blue; }</style>
126 </head>
127 <body>
128 <p> Long text with more than twenty characters. Extra content. </p>
129 </body>
130 </html>
131 """
132 reduced = reduce_html(raw_html, 2)
133 # For level 2, text should be truncated to the first 20 characters after normalization.
134 # The original text "Long text with more than twenty characters. Extra content."
135 # normalized becomes "Long text with more than twenty characters. Extra content."
136 # and then truncated to: "Long text with more t" (first 20 characters)
137 assert "Long text with more t" in reduced
138 # Confirm that style tags contents are completely removed
139 assert ".unused" not in reduced
140
141
142def test_reduce_html_no_body():

Callers

nothing calls this directly

Calls 1

reduce_htmlFunction · 0.90

Tested by

no test coverage detected