Esempio n. 1
0
def test_truncate():
    s = "   <p>one</p><ol><li>two</li><li> three</li> </ol> four <p>five</p>"

    eq_(truncate(s, 100), s)
    eq_(truncate(s, 6), "<p>one</p><ol><li>two...</li></ol>")
    eq_(truncate(s, 5, True), "<p>one</p><ol><li>tw...</li></ol>")
    eq_(truncate(s, 11), "<p>one</p><ol><li>two</li><li>three...</li></ol>")
    eq_(truncate(s, 15), "<p>one</p><ol><li>two</li><li>three</li></ol>four...")
    eq_(truncate(s, 13, True, "xxx"), "<p>one</p><ol><li>two</li><li>three</li></ol>foxxx")
Esempio n. 2
0
def test_truncate():
    s = '   <p>one</p><ol><li>two</li><li> three</li> </ol> four <p>five</p>'

    eq_(truncate(s, 100), s)
    eq_(truncate(s, 6), '<p>one</p><ol><li>two...</li></ol>')
    eq_(truncate(s, 5, True), '<p>one</p><ol><li>tw...</li></ol>')
    eq_(truncate(s, 11), '<p>one</p><ol><li>two</li><li>three...</li></ol>')
    eq_(truncate(s, 15),
        '<p>one</p><ol><li>two</li><li>three</li></ol>four...')
    eq_(truncate(s, 13, True, 'xxx'),
        '<p>one</p><ol><li>two</li><li>three</li></ol>foxxx')
Esempio n. 3
0
def test_truncate():
    s = '   <p>one</p><ol><li>two</li><li> three</li> </ol> four <p>five</p>'

    eq_(truncate(s, 100), s)
    eq_(truncate(s, 6), '<p>one</p><ol><li>two...</li></ol>')
    eq_(truncate(s, 5, True), '<p>one</p><ol><li>tw...</li></ol>')
    eq_(truncate(s, 11), '<p>one</p><ol><li>two</li><li>three...</li></ol>')
    eq_(truncate(s, 15),
        '<p>one</p><ol><li>two</li><li>three</li></ol>four...')
    eq_(truncate(s, 13, True, 'xxx'),
        '<p>one</p><ol><li>two</li><li>three</li></ol>foxxx')
Esempio n. 4
0
def test_truncate():
    s = '   <p>one</p><ol><li>two</li><li> three</li> </ol> four <p>five</p>'

    assert truncate(s, 100) == s
    assert truncate(s, 6) == '<p>one</p><ol><li>two...</li></ol>'
    assert truncate(s, 5, True) == '<p>one</p><ol><li>tw...</li></ol>'
    assert truncate(s, 11) == (
        '<p>one</p><ol><li>two</li><li>three...</li></ol>')
    assert truncate(s, 15) == (
        '<p>one</p><ol><li>two</li><li>three</li></ol>four...')
    assert truncate(s, 13, True, 'xxx') == (
        '<p>one</p><ol><li>two</li><li>three</li></ol>foxxx')