def test(self): wrapper = ParagraphWrapper(width=5) self.assertEqual( wrapper.wrap('12\n' '34\n' '56\n' '78\n' '90\n' '\n' '1234567890'), ['12 34', '56 78', '90', '', '12345', '67890'] )
def test(self): wrapper = ParagraphWrapper(width=5) self.assertEqual( wrapper.fill('12\n' '34\n' '56\n' '78\n' '90\n' '\n' '1234567890'), '12 34\n' '56 78\n' '90\n' '\n' '12345\n' '67890' )
def test_empty(self): self.assertEqual(ParagraphWrapper.split(''), ['']) self.assertEqual(ParagraphWrapper.split('\n'), ['']) self.assertEqual(ParagraphWrapper.split('\n\n'), ['']) self.assertEqual(ParagraphWrapper.split('\n\n\n'), ['']) self.assertEqual(ParagraphWrapper.split('\n\n\n\n'), ['']) self.assertEqual(ParagraphWrapper.split('\n\n \n\n'), [''])
def test_trailing_whitespace(self): self.assertEqual(ParagraphWrapper.split(' '), [' ']) self.assertEqual(ParagraphWrapper.split(' \n'), [' ']) self.assertEqual(ParagraphWrapper.split(' \n\n'), [' ', '']) self.assertEqual(ParagraphWrapper.split(' \n\n\n\n'), [' ', '']) self.assertEqual(ParagraphWrapper.split(' \n\n \n\n'), [' ', ''])