예제 #1
0
 def message_excerpt(self, obj):
     return truncate_text(obj.message, 140)[0] if obj.message else ''
예제 #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))
예제 #3
0
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)
예제 #4
0
 def truncated_body(self, obj):
     return truncate_text(obj.body, 140)[0]
예제 #5
0
 def message_excerpt(self, obj):
     return truncate_text(obj.message, 140)[0] if obj.message else ''
예제 #6
0
 def truncated_body(self, obj):
     return truncate_text(obj.body, 140)[0] if obj.body else ''
예제 #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))
예제 #8
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))