# retoor from html.parser import HTMLParser from devplacepy.rendering import ( markdown_structure_signature, render_content, render_title, safe_truncate, ) def test_emoji_shortcodes(): out = str(render_content("ship it :rocket: :fire:")) assert "\U0001F680" in out assert "\U0001F525" in out assert ":rocket:" not in out def test_markdown_structure_signature_counts_elements(): text = ( "# Title\n\n" "- one\n- two\n\n" "1. first\n2. second\n\n" "```python\nprint(1)\n```\n\n" "[link](https://example.com)\n" ) assert markdown_structure_signature(text) == { "code_fences": 1, "list_items": 4, "headers": 1, "links": 1, } def test_markdown_structure_signature_blank_text(): assert markdown_structure_signature("") == { "code_fences": 0, "list_items": 0, "headers": 0, "links": 0, } def test_markdown_structure_signature_ignores_word_changes(): original = markdown_structure_signature("- alpha\n- beta\n- gamma\n") reworded = markdown_structure_signature("- Alpha\n- beta\n- gamma\n") assert original == reworded def test_markdown_bold_and_italic(): out = str(render_content("this is **bold** and _em_")) assert "bold" in out assert "em" in out def test_youtube_embed(): out = str(render_content("watch https://youtu.be/dQw4w9WgXcQ now")) assert 'class="embed-youtube"' in out assert "https://www.youtube.com/embed/dQw4w9WgXcQ" in out assert "' in out def test_audio_embed(): out = str(render_content("sound https://example.com/a.mp3")) assert '