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
def test_content_not_escaped(): content = Content('<a>test</a>', tag='p', id='id<br>', escape=False) assert content.html() == '<p id="id<br>"><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<br>">te<br>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<br>"><a>test</a></p>' assert content.text() == '<a>test</a>\n\n' assert content._json() == ('id<br>', '<a>test</a>')