Ejemplo n.º 1
0
    def test_quote_simple(self):
        'Ensure that short-lines with quotes are left as is.'
        msg = ('Their nextdoor neighbor was Mrs April Simbol:\n'
               '> Kipling road was a sort of a typical East End street. People\n'
               '> were in and out of each other\'s houses with each other\'s\n'
               '> property all day long.')
        r = wrap_message(msg)

        self.assertEqual(msg, r)
Ejemplo n.º 2
0
    def test_wrap_simple_quoted(self):
        'Ensure simple bottom quoting is fine'
        with open_test_file('short.txt') as testIn:
            msg = testIn.read()
        r = wrap_message(msg)

        with open_test_file('short-expected.txt') as expectedIn:
            expected = expectedIn.read()
        self.assertEqual(expected, r)
Ejemplo n.º 3
0
    def test_url(self):
        'Ensure that a URL with dashes is not split'
        msg = ('This is a long string that ends with a URL that has dashes '
               '<https://manu.ninja/dominant-colors-for-lazy-loading-images>')
        r = wrap_message(msg)

        expected = ('This is a long string that ends with a URL that has dashes\n'  # Note the \n
                    '<https://manu.ninja/dominant-colors-for-lazy-loading-images>')
        self.assertEqual(expected, r)
Ejemplo n.º 4
0
    def test_wrap_simple_quoted(self):
        'Ensure simple bottom quoting is fine'
        with open_test_file('short.txt') as testIn:
            msg = testIn.read()
        r = wrap_message(msg)

        with open_test_file('short-expected.txt') as expectedIn:
            expected = expectedIn.read()
        self.assertEqual(expected, r)
Ejemplo n.º 5
0
    def test_url(self):
        'Ensure that a URL with dashes is not split'
        msg = ('This is a long string that ends with a URL that has dashes '
               '<https://manu.ninja/dominant-colors-for-lazy-loading-images>')
        r = wrap_message(msg)

        expected = (
            'This is a long string that ends with a URL that has dashes\n'  # Note the \n
            '<https://manu.ninja/dominant-colors-for-lazy-loading-images>')
        self.assertEqual(expected, r)
Ejemplo n.º 6
0
    def test_quote_simple(self):
        'Ensure that short-lines with quotes are left as is.'
        msg = (
            'Their nextdoor neighbor was Mrs April Simbol:\n'
            '> Kipling road was a sort of a typical East End street. People\n'
            '> were in and out of each other\'s houses with each other\'s\n'
            '> property all day long.')
        r = wrap_message(msg)

        self.assertEqual(msg, r)
Ejemplo n.º 7
0
    def test_wrap_tricky(self):
        'Ensure we handle tricky messages from Mozilla Tunderbird'
        # --=mpj17=-- It seems as if Mozilla Thunderbird uses the HTML version of the message
        # for the bottom quoting, rather than the plain-text, and this causes no end of issues
        # with the splitting, and trying to find the bottom of the message.
        self.maxDiff = None
        with open_test_file('tricky.txt') as testIn:
            msg = testIn.read()
        r = wrap_message(msg)

        with open_test_file('tricky-expected.txt') as expectedIn:
            expected = expectedIn.read()
        self.assertEqual(expected, r)
Ejemplo n.º 8
0
    def test_wrap_tricky(self):
        'Ensure we handle tricky messages from Mozilla Tunderbird'
        # --=mpj17=-- It seems as if Mozilla Thunderbird uses the HTML version of the message
        # for the bottom quoting, rather than the plain-text, and this causes no end of issues
        # with the splitting, and trying to find the bottom of the message.
        self.maxDiff = None
        with open_test_file('tricky.txt') as testIn:
            msg = testIn.read()
        r = wrap_message(msg)

        with open_test_file('tricky-expected.txt') as expectedIn:
            expected = expectedIn.read()
        self.assertEqual(expected, r)
Ejemplo n.º 9
0
    def test_whitespace(self):
        'Ensure whitespace is collapsed'
        r = wrap_message('\n ')

        self.assertEqual('\n', r)
Ejemplo n.º 10
0
    def test_empty(self):
        'Ensure an empty string is empty when wrapped'
        r = wrap_message('')

        self.assertEqual('', r)
Ejemplo n.º 11
0
    def test_whitespace(self):
        'Ensure whitespace is collapsed'
        r = wrap_message('\n ')

        self.assertEqual('\n', r)
Ejemplo n.º 12
0
    def test_empty(self):
        'Ensure an empty string is empty when wrapped'
        r = wrap_message('')

        self.assertEqual('', r)