@@ -16,6 +16,39 @@ def handle_starttag(self, tag, attrs):
1616 self .urls .append (dict (attrs ).get ("href" , "" ))
1717
1818
19+ class VisibleText (HTMLParser ):
20+ def __init__ (self , text ):
21+ super ().__init__ ()
22+ self .parts = []
23+ self .skip = 0
24+ self .feed (text )
25+
26+ def handle_starttag (self , tag , attrs ):
27+ if tag in ("script" , "style" ):
28+ self .skip += 1
29+
30+ def handle_endtag (self , tag ):
31+ if tag in ("script" , "style" ):
32+ self .skip -= 1
33+
34+ def handle_data (self , data ):
35+ if not self .skip :
36+ self .parts .append (data )
37+
38+ @property
39+ def text (self ):
40+ return " " .join (" " .join (self .parts ).split ()).casefold ()
41+
42+
43+ REJECTED_CLAIMS = [
44+ "protected storybook" ,
45+ "ready for approval" ,
46+ "catalogue snapshots" ,
47+ "publisher deployed-stage e2e" ,
48+ "automatic link refresh" ,
49+ ]
50+
51+
1952class ReportContract (unittest .TestCase ):
2053 def setUp (self ):
2154 self .data = json .loads (
@@ -38,16 +71,10 @@ def test_images_match_recorded_evidence(self):
3871 def test_rejected_catalogue_links_and_claims_are_absent (self ):
3972 for slug in self .data ["reports" ]:
4073 text = (ROOT / "reports" / slug / "index.html" ).read_text (encoding = "utf-8" )
41- for url in Links (text ).urls :
42- self .assertNotIn ("pages.hyperide.ai" , url )
43- for phrase in [
44- "Protected Storybook" ,
45- "Ready for approval" ,
46- "catalogue snapshots" ,
47- "Publisher deployed-stage E2E" ,
48- "automatic link refresh" ,
49- ]:
50- self .assertNotIn (phrase , text )
74+ self .assertNotIn ("pages.hyperide.ai" , text .casefold ())
75+ visible = VisibleText (text ).text
76+ for phrase in REJECTED_CLAIMS :
77+ self .assertNotIn (phrase , visible )
5178
5279 def test_conloca_keeps_tested_preview_attribution_and_images (self ):
5380 text = (ROOT / "reports/conloca-2026-10/index.html" ).read_text (encoding = "utf-8" )
0 commit comments