Skip to content

Commit 7e4baeb

Browse files
committed
Add debug test for CI investigation
1 parent 1e6e1c5 commit 7e4baeb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_debug_ci.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\nafter", f"Expected 'before\\n\\nafter', got {repr(result)}"

0 commit comments

Comments
 (0)