def test_wrap_long_lines_doesnt_swallow_spaces(self):
     text = "A  really  long  line  that  uses  multiple  spaces  to  go  over  80  chars  by  a  country  mile"
     expected_text = (
         "A  really  long  line  that  uses  multiple  spaces  to  go  over  80  chars\nby  a  country  mile"
     )
     # TODO: handle trailing space corner case?
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
 def test_wrap_long_lines_with_unbroken_chars(self):
     text = "." * 479
     expected_text = (
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "....."
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
 def test_wrap_long_lines_with_words(self):
     self.assertEqual(wrap_long_lines('normal line'), 'normal line')
     text = (
         "This is a short line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over 79 chars in length\n"
         "This line is fine though."
     )
     expected_text = (
         "This is a short line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over\n"
         "79 chars in length\n"
         "This line is fine though."
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
 def test_wrap_long_lines_with_words_2(self):
     text = (
         "ViewDoesNotExist: Could not import superlists.views.home. Parent module superlists.views does not exist."
     )
     expected_text = (
         "ViewDoesNotExist: Could not import superlists.views.home. Parent module\nsuperlists.views does not exist."
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
 def test_wrap_long_lines_with_unbroken_chars_2(self):
     text = (
         "E\n"
         "======================================================================\n"
         "ERROR: test_root_url_resolves_to_home_page_view (lists.tests.HomePageTest)"
     )
     expected_text = (
         "E\n"
         "======================================================================\n"
         "ERROR: test_root_url_resolves_to_home_page_view (lists.tests.HomePageTest)"
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
Beispiel #6
0
 def test_wrap_long_lines_with_words(self):
     self.assertEqual(wrap_long_lines('normal line'), 'normal line')
     text = (
         "This is a short line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over 79 chars in length\n"
         "This line is fine though.")
     expected_text = (
         "This is a short line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over\n"
         "79 chars in length\n"
         "This line is fine though.")
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
Beispiel #7
0
 def test_wrap_long_lines_with_unbroken_chars_2(self):
     text = (
         "E\n"
         "======================================================================\n"
         "ERROR: test_root_url_resolves_to_home_page_view (lists.tests.HomePageTest)"
     )
     expected_text = (
         "E\n"
         "======================================================================\n"
         "ERROR: test_root_url_resolves_to_home_page_view (lists.tests.HomePageTest)"
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
 def test_wrap_long_lines_with_unbroken_chars(self):
     text = "." * 479
     expected_text = (
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "." * 79 + "\n" +
             "....."
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
Beispiel #9
0
 def test_wrap_long_lines_with_indent(self):
     text = (
         "This is a short line\n"
         "   This is a long line with an indent which should wrap just "
         "before the word that takes it over 79 chars in length\n"
         "   This is a short indented line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over 79 chars in length")
     expected_text = (
         "This is a short line\n"
         "   This is a long line with an indent which should wrap just "
         "before the word\n"
         "that takes it over 79 chars in length\n"
         "   This is a short indented line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over\n"
         "79 chars in length")
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
 def test_wrap_long_lines_with_indent(self):
     text = (
         "This is a short line\n"
         "   This is a long line with an indent which should wrap just "
         "before the word that takes it over 79 chars in length\n"
         "   This is a short indented line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over 79 chars in length"
     )
     expected_text = (
         "This is a short line\n"
         "   This is a long line with an indent which should wrap just "
         "before the word\n"
         "that takes it over 79 chars in length\n"
         "   This is a short indented line\n"
         "This is a long line which should wrap just before the word that "
         "takes it over\n"
         "79 chars in length"
     )
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
    def test_wrap_long_lines_with_words_3(self):

        text = '  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 442, in supports_transactions'
        expected_text = '  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py",\nline 442, in supports_transactions'
        self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
Beispiel #12
0
 def test_wrap_long_lines_doesnt_swallow_spaces(self):
     text = "A  really  long  line  that  uses  multiple  spaces  to  go  over  80  chars  by  a  country  mile"
     expected_text = "A  really  long  line  that  uses  multiple  spaces  to  go  over  80  chars\nby  a  country  mile"
     #TODO: handle trailing space corner case?
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
Beispiel #13
0
    def test_wrap_long_lines_with_words_3(self):

        text = '  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 442, in supports_transactions'
        expected_text = '  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py",\nline 442, in supports_transactions'
        self.assertMultiLineEqual(wrap_long_lines(text), expected_text)
Beispiel #14
0
 def test_wrap_long_lines_with_words_2(self):
     text = "ViewDoesNotExist: Could not import superlists.views.home. Parent module superlists.views does not exist."
     expected_text = "ViewDoesNotExist: Could not import superlists.views.home. Parent module\nsuperlists.views does not exist."
     self.assertMultiLineEqual(wrap_long_lines(text), expected_text)