def test_multiple_lines(self): """ Truncate values that have more than a single line of text by only showing the first line. """ self.assertThat(format.truncate_value(10, u'abc\ndef'), ExactlyEquals(u'abc\u2026'))
def test_over(self): """ Truncate values whose length is above the limit. """ self.assertThat( format.truncate_value(10, u'abcdefghijklmnopqrstuvwxyz'), ExactlyEquals(u'abcdefghij\u2026'))
def test_under(self): """ No truncation occurs if the length of the value is below the limit. """ self.assertThat( format.truncate_value(10, u'abcdefghijklmnopqrstuvwxyz'[:5]), ExactlyEquals(u'abcde'))
def test_exact(self): """ No truncation occurs if the length of the value is exactly at the limit. """ self.assertThat( format.truncate_value(10, u'abcdefghijklmnopqrstuvwxyz'[:10]), ExactlyEquals(u'abcdefghij'))