Пример #1
0
def test_truncate_title_that_is_too_long():
    truncated_title = 'a' * 253  # the title will be truncated this much
    title = truncated_title + 'aaaaa'  # len(title) > 256
    expected = truncated_title + '...'
    actual = FoodPost.truncate(title)
    assert actual != title
    assert actual == expected
Пример #2
0
def test_truncate_returns_none_for_none_input():
    assert FoodPost.truncate(None) is None
Пример #3
0
def test_truncate_does_nothing_for_shorter_title():
    title = 'something short'
    assert FoodPost.truncate(title) == title