~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/translations/utilities/tests/test_sanitize.py

  • Committer: Steve Kowalik
  • Date: 2011-09-07 11:34:06 UTC
  • mto: This revision was merged to the branch mainline in revision 13891.
  • Revision ID: stevenk@ubuntu.com-20110907113406-e6kf295c5zxs50om
Revert r13889.

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
                    MixedNewlineMarkersError,
159
159
                    sanitizer.normalizeNewlines, translation_text)
160
160
 
161
 
    def test_verifyNewlineConsistency_with_consistent_newlines(self):
162
 
        # Consistent newlines in the text will not raise an exception.
163
 
        translation_template = u"Text with %s consistent %s newlines."
164
 
        for translation_newline in self.newline_styles:
165
 
            translation_text = translation_template % (
166
 
                translation_newline, translation_newline)
167
 
            Sanitizer.verifyNewlineConsistency(translation_text)
168
 
 
169
 
    def test_verifyNewlineConsistency_with_mixed_newlines(self):
170
 
        # Consistent newlines in the text will not raise an exception.
171
 
        translation_template = u"Text with %s mixed %s newlines."
172
 
        for translation_newline_1 in self.newline_styles:
173
 
            other_newlines = self.newline_styles[:]
174
 
            other_newlines.remove(translation_newline_1)
175
 
            for translation_newline_2 in other_newlines:
176
 
                translation_text = translation_template % (
177
 
                    translation_newline_1, translation_newline_2)
178
 
                self.assertRaises(
179
 
                    MixedNewlineMarkersError,
180
 
                    Sanitizer.verifyNewlineConsistency, translation_text)
181
 
 
182
161
    def test_sanitize(self):
183
162
        # Calling the Sanitizer object will apply all sanitization procedures.
184
163
        sanitizer = Sanitizer(u"Text with\nnewline.")