"""Unit tests for card fragment parser.""" from __future__ import annotations import pytest from blog.bp.blog.services.posts_data import _parse_card_fragments class TestParseCardFragments: def test_empty_string(self): assert _parse_card_fragments("") == {} def test_single_block(self): html = '
line1
\nline2
\n' result = _parse_card_fragments(html) assert "5" in result assert "line1
" in result["5"] def test_mismatched_ids_not_captured(self): html = 'content' result = _parse_card_fragments(html) assert result == {} def test_no_markers(self): html = '