def test_t_lets_appending_take_over(self): assert truncate('I am a long sentence.', 21, ' the cheese!') == 'I am a long sentence.' assert truncate('I am a long sentence.', 20, ' the cheese!') == 'I am a the cheese!' assert truncate('I am a long sentence.', 19, ' the cheese!') == 'I am a the cheese!' assert truncate('I am a long sentence.', 18, ' the cheese!') == 'I am a the cheese!' assert truncate('I am a long sentence.', 17, ' the cheese!') == 'I am the cheese!' assert truncate('I am a long sentence.', 16, ' the cheese!') == 'I am the cheese!' assert truncate('I am a long sentence.', 15, ' the cheese!') == 'I the cheese!' assert truncate('I am a long sentence.', 14, ' the cheese!') == 'I the cheese!' assert truncate('I am a long sentence.', 13, ' the cheese!') == 'I the cheese!' assert truncate('I am a long sentence.', 12, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 11, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 10, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 9, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 8, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 7, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 6, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 5, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 4, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 3, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 2, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 1, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 0, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', -1, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', -1000, ' the cheese!') == ' the cheese!'
def test_t_returns_whole_thing_if_possible(self): assert truncate('I am a long sentence.', 20) == 'I am a long …' assert truncate('I am a long sentence.', 21) == 'I am a long sentence.' assert truncate('I am a long sentence.', 22) == 'I am a long sentence.' assert truncate('I am a long sentence.', 220000) == 'I am a long sentence.'
def test_t_appends_what_you_like(self): assert truncate('I am a long sentence.', 14, ' cheese.') == 'I am a cheese.'
def test_t_finds_word_break_properly(self): assert truncate('I am a long sentence.', 12) == 'I am a …' assert truncate('I am a long sentence.', 14) == 'I am a long …'
def test_t_splits_words_if_it_has_to(self): assert truncate('I_am_a_long_sentence.', 17) == 'I_am_a_long_sen …'
def test_t_truncates(self): assert truncate('I am a long sentence.', 13) == 'I am a long …'
def test_t_doesnt_split_words(self): assert truncate('I am a long sentence.', 16) == 'I am a long …'
def test_appends_what_you_like(self): assert truncate('I am a long sentence.', 14, ' cheese.') == 'I am a cheese.'
def test_lets_appending_take_over(self): assert truncate('I am a long sentence.', 21, ' the cheese!') == 'I am a long sentence.' assert truncate('I am a long sentence.', 20, ' the cheese!') == 'I am a the cheese!' assert truncate('I am a long sentence.', 19, ' the cheese!') == 'I am a the cheese!' assert truncate('I am a long sentence.', 18, ' the cheese!') == 'I am a the cheese!' assert truncate('I am a long sentence.', 17, ' the cheese!') == 'I am the cheese!' assert truncate('I am a long sentence.', 16, ' the cheese!') == 'I am the cheese!' assert truncate('I am a long sentence.', 15, ' the cheese!') == 'I the cheese!' assert truncate('I am a long sentence.', 14, ' the cheese!') == 'I the cheese!' assert truncate('I am a long sentence.', 13, ' the cheese!') == 'I the cheese!' assert truncate('I am a long sentence.', 12, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 11, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 10, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 9, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 8, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 7, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 6, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 5, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 4, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 3, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 2, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 1, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', 0, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', -1, ' the cheese!') == ' the cheese!' assert truncate('I am a long sentence.', -1000, ' the cheese!') == ' the cheese!'
def test_returns_whole_thing_if_possible(self): assert truncate('I am a long sentence.', 20) == 'I am a long …' assert truncate('I am a long sentence.', 21) == 'I am a long sentence.' assert truncate('I am a long sentence.', 22) == 'I am a long sentence.' assert truncate('I am a long sentence.', 220000) == 'I am a long sentence.'
def test_splits_words_if_it_has_to(self): assert truncate('I_am_a_long_sentence.', 17) == 'I_am_a_long_sen …'
def test_finds_word_break_properly(self): assert truncate('I am a long sentence.', 12) == 'I am a …' assert truncate('I am a long sentence.', 14) == 'I am a long …'
def test_doesnt_split_words(self): assert truncate('I am a long sentence.', 16) == 'I am a long …'
def test_truncates(self): assert truncate('I am a long sentence.', 13) == 'I am a long …'