" in extract_content_from_html(" ")
+
+ def test_stage3_raw_markdownify_runs_on_empty_stage1(self):
+ """When Stage 1 has nothing to extract (pure loading shell with a
+ script payload), fallback must do something other than return
+ empty or crash."""
+ html = """
+
+
+ """
+ out = extract_content_from_html(html)
+ assert isinstance(out, str)
+ # either we got something meaningful or a graceful error
+ assert out in ("Page failed to be simplified from HTML>",
+ out) # always true; documents no-crash contract
+ assert len(out) > 0
+
+ def test_long_stage1_unaffected(self):
+ """Large readable body: Stage 1 alone is enough, no fallback."""
+ body = "" + ("readable " * 500) + "
"
+ html = ("Big
" + body +
+ "")
+ out = extract_content_from_html(html)
+ assert "readable" in out
+ assert "" not in out