Beispiel #1
0
 def message_excerpt(self, obj):
     return truncate_text(obj.message, 140)[0] if obj.message else ''
Beispiel #2
0
def test_truncate_text():
    eq_(truncate_text('foobar', 5), ('...', 0))
    eq_(truncate_text('foobar', 5, True), ('fooba...', 0))
    eq_(truncate_text('foobar', 5, True, 'xxx'), ('foobaxxx', 0))
    eq_(truncate_text('foobar', 6), ('foobar...', 0))
    eq_(truncate_text('foobar', 7), ('foobar', 1))
def test_truncate_text():
    assert truncate_text('foobar', 5) == ('fooba...', 0)
    assert truncate_text('foobar', 5, True) == ('fooba...', 0)
    assert truncate_text('foobar', 5, True, 'xxx') == ('foobaxxx', 0)
    assert truncate_text('foobar', 6) == ('foobar...', 0)
    assert truncate_text('foobar', 7) == ('foobar', 1)
Beispiel #4
0
 def truncated_body(self, obj):
     return truncate_text(obj.body, 140)[0]
Beispiel #5
0
 def message_excerpt(self, obj):
     return truncate_text(obj.message, 140)[0] if obj.message else ''
Beispiel #6
0
 def truncated_body(self, obj):
     return truncate_text(obj.body, 140)[0] if obj.body else ''
Beispiel #7
0
def test_truncate_text():
    eq_(truncate_text("foobar", 5), ("fooba...", 0))
    eq_(truncate_text("foobar", 5, True), ("fooba...", 0))
    eq_(truncate_text("foobar", 5, True, "xxx"), ("foobaxxx", 0))
    eq_(truncate_text("foobar", 6), ("foobar...", 0))
    eq_(truncate_text("foobar", 7), ("foobar", 1))
def test_truncate_text():
    eq_(truncate_text('foobar', 5), ('...', 0))
    eq_(truncate_text('foobar', 5, True), ('fooba...', 0))
    eq_(truncate_text('foobar', 5, True, 'xxx'), ('foobaxxx', 0))
    eq_(truncate_text('foobar', 6), ('foobar...', 0))
    eq_(truncate_text('foobar', 7), ('foobar', 1))