示例#1
0
def test_invalid_node():
    fixture = load_fixture('invalid_node.json')
    with pytest.raises(UnhandledNodeError):
        render(fixture)
示例#2
0
def test_nested_marks():
    fixture = load_fixture('nested_marks.json')
    output = render(fixture)
    assert output == '<p><strong>A word of <em>warning;</em></strong> Sanity is addictive.</p>'
示例#3
0
def test_missing_serializer():
    fixture = load_fixture('invalid_type.json')
    with pytest.raises(MissingSerializerError):
        render(fixture)
示例#4
0
def test_multiple_adjecent_marks():
    fixture = load_fixture('multiple_adjecent_marks.json')
    output = render(fixture)
    assert output == '<p><strong>A word of warning;</strong> Sanity is addictive.</p>'
示例#5
0
def test_basic_mark():
    fixture = load_fixture('basic_mark.json')
    output = render(fixture)
    assert output == '<p><code>sanity</code> is the name of the CLI tool.</p>'
示例#6
0
def test_simple_xss_escaping():
    simple_span_def = load_fixture('simple_xss.json')
    output = render(simple_span_def)
    danger = html.escape('<script>alert(1)</script>')
    assert output == f'<p>Otovo guarantee is {danger} good</p>'
示例#7
0
def test_multiple_simple_spans_in_single_block():
    fixture = load_fixture('multiple_simple_spans.json')
    output = render(fixture)
    assert output == '<p>Otovo guarantee is good for all</p>'
示例#8
0
def test_simple_span():
    simple_span_def = load_fixture('simple_span.json')
    output = render(simple_span_def)
    assert output == '<p>Otovo guarantee is good</p>'