"""Tests for _strip_html edge cases."""
from tuimble.app import _strip_html
def test_plain_text_unchanged():
assert _strip_html("hello world") == "hello world"
def test_simple_tags_stripped():
assert _strip_html("bold") == "bold"
def test_nested_tags():
assert _strip_html("
") == "text"
def test_self_closing_tags():
assert _strip_html("line
break") == "linebreak"
def test_entities_unescaped():
assert _strip_html("& < >") == "& < >"
def test_html_entities_in_tags():
assert _strip_html("&") == "&"
def test_mumble_style_message():
"""Typical Mumble chat message with anchor tag."""
msg = 'link text and more'
assert _strip_html(msg) == "link text and more"
def test_img_tag_with_attributes():
assert _strip_html('before
after') == "beforeafter"
def test_comment_stripped():
assert _strip_html("beforeafter") == "beforeafter"
def test_empty_string():
assert _strip_html("") == ""
def test_only_tags():
assert _strip_html("
") == ""
def test_unclosed_tag():
"""Malformed HTML should not crash."""
result = _strip_html("unclosed")
assert "unclosed" in result
def test_multiple_entities():
assert _strip_html(""quoted"") == '"quoted"'