示例#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)
示例#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)
示例#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)
示例#4
0
 def check(self, expected, text, linewidth):
     return self.assertEqual(
         expected,
         count_lines_with_wrapping(text, linewidth),
     )
示例#5
0
 def test_count_empty(self):
     """Test with an empty string."""
     self.assertEqual(count_lines_with_wrapping(""), 0)
示例#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)
示例#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)
示例#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)
示例#9
0
 def test_count_empty(self):
     """Test with an empty string."""
     self.assertEqual(count_lines_with_wrapping(""), 0)
示例#10
0
 def check(self, expected, text, linewidth, tabwidth):
     return self.assertEqual(
         expected,
         count_lines_with_wrapping(text, linewidth, tabwidth),
     )