Exemple #1
0
def test_content_simple_string():
    content = Content('test', tag='p', id='id', attrs={'foo': 'foo'})
    assert content.html() == '<p foo="foo" id="id">test</p>'
    assert content.text() == 'test\n\n'
    assert content._json() == ('id', 'test')
    assert Content('test', tag='h1').text() == 'test\n====\n\n'
    assert Content('test')._json() is None
Exemple #2
0
def test_content_not_escaped():
    content = Content('<a>test</a>',
                      tag='p',
                      attrs={'id': 'id<br>'},
                      escape=False)
    assert content.html() == '<p id="id&lt;br&gt;"><a>test</a></p>'
    assert content.text() == '<a>test</a>\n\n'
def test_content_simple_string():
    content = Content('test', tag='p', id='id', attrs={'foo': 'foo'})
    assert content.html() == '<p foo="foo" id="id">test</p>'
    assert content.text() == 'test\n\n'
    assert content._json() == ('id', 'test')
    assert Content('test', tag='h1').text() == 'test\n====\n\n'
    assert Content('test')._json() is None
Exemple #4
0
def test_content_escaped():
    content = Content('te<br>st', tag='p', attrs={'id': 'id<br>'})
    assert content.html() == '<p id="id&lt;br&gt;">te&lt;br&gt;st</p>'
    assert content.text() == 'te<br>st\n\n'
Exemple #5
0
def test_content_simple_string():
    content = Content('test', tag='p', attrs={'id': 'id'})
    assert content.html() == '<p id="id">test</p>'
    assert content.text() == 'test\n\n'
    assert Content('test', tag='h1').text() == 'test\n====\n\n'
Exemple #6
0
def test_content_not_escaped():
    content = Content('<a>test</a>', tag='p', id='id<br>', escape=False)
    assert content.html() == '<p id="id&lt;br&gt;"><a>test</a></p>'
    assert content.text() == '<a>test</a>\n\n'
    assert content._json() == ('id<br>', '<a>test</a>')
Exemple #7
0
def test_content_escaped():
    content = Content('te<br>st', tag='p', id='id<br>')
    assert content.html() == '<p id="id&lt;br&gt;">te&lt;br&gt;st</p>'
    assert content.text() == 'te<br>st\n\n'
    assert content._json() == ('id<br>', 'te<br>st')
def test_content_not_escaped():
    content = Content(
        '<a>test</a>', tag='p', id='id<br>', escape=False)
    assert content.html() == '<p id="id&lt;br&gt;"><a>test</a></p>'
    assert content.text() == '<a>test</a>\n\n'
    assert content._json() == ('id<br>', '<a>test</a>')
def test_content_escaped():
    content = Content('te<br>st', tag='p', id='id<br>')
    assert content.html() == '<p id="id&lt;br&gt;">te&lt;br&gt;st</p>'
    assert content.text() == 'te<br>st\n\n'
    assert content._json() == ('id<br>', 'te<br>st')