def test_quote(self): 'Ensure quoted text is wrapped with its quotation' w = Wrapper(70) l = ("> Kipling road was a sort of a typical East End street. People " "were in and out of each other's houses with each other's " "property all day long.") r = w.wrap_line(l) expected = ("> Kipling road was a sort of a typical East End street. People were in\n" "> and out of each other's houses with each other's property all day\n" "> long.") self.assertEqual(expected, r)
def test_multi(self): 'Ensure that multiple-quotes are wrapped correctly' 'Ensure quoted text is wrapped with its quotation' w = Wrapper(70) l = (">>> Kipling road was a sort of a typical East End street. People " "were in and out of each other's houses with each other's " "property all day long.") r = w.wrap_line(l) expected = (">>> Kipling road was a sort of a typical East End street. People were\n" ">>> in and out of each other's houses with each other's property all\n" ">>> day long.") self.assertEqual(expected, r)
def test_quote(self): 'Ensure quoted text is wrapped with its quotation' w = Wrapper(70) l = ("> Kipling road was a sort of a typical East End street. People " "were in and out of each other's houses with each other's " "property all day long.") r = w.wrap_line(l) expected = ( "> Kipling road was a sort of a typical East End street. People were in\n" "> and out of each other's houses with each other's property all day\n" "> long.") self.assertEqual(expected, r)
def test_multi(self): 'Ensure that multiple-quotes are wrapped correctly' 'Ensure quoted text is wrapped with its quotation' w = Wrapper(70) l = ( ">>> Kipling road was a sort of a typical East End street. People " "were in and out of each other's houses with each other's " "property all day long.") r = w.wrap_line(l) expected = ( ">>> Kipling road was a sort of a typical East End street. People were\n" ">>> in and out of each other's houses with each other's property all\n" ">>> day long.") self.assertEqual(expected, r)
def test_whitespace(self): 'Ensure whitespace is collapsed' w = Wrapper(70) r = w.wrap_line(' ') self.assertEqual('', r)
def test_empty(self): 'Ensure an empty string is empty when wrapped' w = Wrapper(70) r = w.wrap_line('') self.assertEqual('', r)
def test_short_line(self): w = Wrapper(70) msg = 'Tonight on Ethel the Frog we look at violence.' r = w.wrap_line('Tonight on Ethel the Frog we look at violence.') self.assertEqual(msg, r)