Esempio n. 1
0
 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'))
Esempio n. 2
0
 def test_over(self):
     """
     Truncate values whose length is above the limit.
     """
     self.assertThat(
         format.truncate_value(10, u'abcdefghijklmnopqrstuvwxyz'),
         ExactlyEquals(u'abcdefghij\u2026'))
Esempio n. 3
0
 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'))
Esempio n. 4
0
 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'))