~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_utextwrap.py

  • Committer: INADA Naoki
  • Date: 2011-05-04 18:30:02 UTC
  • mto: This revision was merged to the branch mainline in revision 5874.
  • Revision ID: songofacandy@gmail.com-20110504183002-rlngoau33j44csyi
Add two tests for fill demonstrates complicated cases. The second test fails
so needs more fixing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
        self.assertEqual(utextwrap.fill(_str_D, 4),
69
69
                "%s\n%s" % (_str_D[:2], _str_D[2:]))
70
70
 
 
71
        # Demonstrate complicated case.
 
72
        text = u"spam ham egg spamhamegg" + _str_D + u" spam" + _str_D*2
 
73
        self.assertEqual(
 
74
                utextwrap.fill(text, 8),
 
75
                u'\n'.join([
 
76
                    "spam ham",
 
77
                    "egg spam",
 
78
                    "hamegg" + _str_D[0],
 
79
                    _str_D[1:],
 
80
                    "spam" + _str_D[:2],
 
81
                    _str_D[2:]+_str_D[:2],
 
82
                    _str_D[2:]
 
83
                    ]))
 
84
 
 
85
        self.assertEqual(
 
86
                utextwrap.fill(text, 8, break_long_words=False),
 
87
                u'\n'.join([
 
88
                    "spam ham",
 
89
                    "egg",
 
90
                    "spamhamegg", 
 
91
                    # border between single width and double width.
 
92
                    _str_D,
 
93
                    "spam" + _str_D[:2],
 
94
                    _str_D[2:]+_str_D[:2],
 
95
                    _str_D[2:]
 
96
                    ]))
 
97
 
 
98
 
71
99
# Regression test with Python's test_textwrap
72
100
# Note that some distribution including Ubuntu doesn't install
73
101
# Python's test suite.