@@ -20,8 +20,8 @@ def test_html_extractor_parses_file(self):
2020 result = extractor .extract ()
2121
2222 self .assertIsInstance (result , ExtractorResult )
23- self .assertIn ("Hello World" , result .md_content )
24- self .assertIn ("test@example.com" , result .md_content )
23+ self .assertIn ("Hello World" , result .text )
24+ self .assertIn ("test@example.com" , result .text )
2525
2626 def test_thei_page (self ):
2727 html_content = """
@@ -79,16 +79,16 @@ def test_thei_page(self):
7979</html>
8080 """
8181
82- no_footer = HtmlExtractor (html_content , "" , "-" ).extract ().md_content
82+ no_footer = HtmlExtractor (html_content , "" , "-" ).extract ().text
8383 self .assertNotIn ("Copyright" , no_footer )
84- no_header = HtmlExtractor (html_content , "-" , "" ).extract ().md_content
84+ no_header = HtmlExtractor (html_content , "-" , "" ).extract ().text
8585 self .assertNotIn ("THEi 设计与建筑系" , no_header )
8686 def test_real_page (self ):
8787 with open ("tests/fixtures/Bachelor of Engineering (Honours) in Building Services Engineering - Technological and Higher Education Institute of Hong Kong.html" , 'r' , encoding = 'utf-8' ) as f :
8888 html_content = f .read ()
8989 header_classes = "mobile-menu-wrapper, breadcrumbs-wrapper, popup-login-wrapper, toolbar"
9090 footer_classes = 'footer,header-info-swapper,thim-widget-button,elementor-widget-social-icons'
91- clean = HtmlExtractor (html_content , header_classes , footer_classes ).extract ().md_content
91+ clean = HtmlExtractor (html_content , header_classes , footer_classes ).extract ().text
9292 self .assertNotIn ("About" , clean )
9393 self .assertNotIn ("Copyright" , clean )
9494 self .assertNotIn ("Apply now" , clean )
@@ -97,8 +97,6 @@ def test_real_page(self):
9797 self .assertIn ("Fluid Mechanics" , clean )
9898 self .assertIn ("4,230" , clean )
9999 print (clean )
100- with open ("output.txt" , "w" , encoding = "utf-8" ) as f :
101- f .write (clean )
102100
103101
104102if __name__ == '__main__' :
0 commit comments