def test_singlegroups(s: str): assert unwind(parse(Registry(NoopBlock, Bold), '*' + s + '*', NoopBlock)) == ['div', ['strong', {}, s]] assert unwind(parse(Registry(NoopBlock, Italic), '_' + s + '_', NoopBlock)) == ['div', ['em', {}, s]] assert unwind( parse(Registry(NoopBlock, Monospace), '`' + s + '`', NoopBlock)) == ['div', ['code', {}, s]]
def test_tooltip(): assert unwind( parse(Registry(NoopBlock, Tooltip), 'T[text](tooltip)', NoopBlock)) == [ 'div', ['span.tooltip', 'text', ['div.tooltip-text', 'tooltip']] ]
def test_header(s: str, n: int): assert unwind( parse(Registry(Paragraphs, Header), '#' * n + ' ' + s, Paragraphs)) == [ 'div', ['h' + str(n), ['a.anchor', { 'id': s.lower() }, s]] ]
def test_standard_registry(): t1 = """ # Placeholder * bold * new paragraph """ assert unwind(parse(Standard, t1)) == [ 'div', ['h1', ['a.anchor', { 'id': 'placeholder' }, 'Placeholder']], ['p', ['strong', {}, ' bold ']], ['p', 'new paragraph'] ]
def test_criticsub(): assert unwind( parse(Registry(Paragraphs, CriticSub), '{~~a~>b~~}', Paragraphs)) == ['div', ['p', [['del', 'a'], ['ins', 'b']]]]