File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ """Debug test to understand CI behavior."""
2+ import sys
3+ from lxml import html , etree
4+
5+ def test_debug_title_parsing ():
6+ """Debug how lxml parses the title tag."""
7+ html_str = 'before<title>ignored</title>after'
8+ tree = html .fromstring (html_str )
9+
10+ print ("\n === Debug Info ===" )
11+ print (f"Python version: { sys .version } " )
12+ print (f"Tree structure: { etree .tostring (tree , encoding = 'unicode' )} " )
13+ print (f"Root tag: { tree .tag } " )
14+ print (f"Root text: { repr (tree .text )} " )
15+ print (f"Root tail: { repr (tree .tail )} " )
16+ print (f"Children: { len (tree )} " )
17+ for i , child in enumerate (tree ):
18+ print (f" Child { i } : tag={ child .tag } , text={ repr (child .text )} , tail={ repr (child .tail )} " )
19+
20+ # Now test actual conversion
21+ from html_to_text import html_to_text
22+ result = html_to_text (html_str )
23+ print (f"Result: { repr (result )} " )
24+ print (f"Result bytes: { result .encode ('utf-8' )} " )
25+
26+ assert result == "before\n \n after" , f"Expected 'before\\ n\\ nafter', got { repr (result )} "
You can’t perform that action at this time.
0 commit comments