Example #1
0
 def test_count_several_lines(self):
     """Test with several lines of text."""
     self.assertEqual(count_lines_with_wrapping("1\n2\n3\n"), 3)
Example #2
0
 def test_count_begins_with_empty_line(self):
     """Test with a string which begins with a newline."""
     self.assertEqual(count_lines_with_wrapping("\ntext"), 2)
Example #3
0
 def test_count_ends_with_empty_line(self):
     """Test with a string which ends with a newline."""
     self.assertEqual(count_lines_with_wrapping("text\n"), 1)
Example #4
0
 def check(self, expected, text, linewidth):
     return self.assertEqual(
         expected,
         count_lines_with_wrapping(text, linewidth),
     )
Example #5
0
 def test_count_empty(self):
     """Test with an empty string."""
     self.assertEqual(count_lines_with_wrapping(""), 0)
Example #6
0
 def test_count_several_lines(self):
     """Test with several lines of text."""
     self.assertEqual(count_lines_with_wrapping("1\n2\n3\n"), 3)
Example #7
0
 def test_count_ends_with_empty_line(self):
     """Test with a string which ends with a newline."""
     self.assertEqual(count_lines_with_wrapping("text\n"), 1)
Example #8
0
 def test_count_begins_with_empty_line(self):
     """Test with a string which begins with a newline."""
     self.assertEqual(count_lines_with_wrapping("\ntext"), 2)
Example #9
0
 def test_count_empty(self):
     """Test with an empty string."""
     self.assertEqual(count_lines_with_wrapping(""), 0)
Example #10
0
 def check(self, expected, text, linewidth, tabwidth):
     return self.assertEqual(
         expected,
         count_lines_with_wrapping(text, linewidth, tabwidth),
     )