def test_sljustify(self): l1 = ['foo', 'x', 'bar', 'zzzz'] l2 = [l1[0] + ' ', l1[1] + ' ', l1[2] + ' ', l1[3]] self.assertEqual(b.simple_line_justifying(l1, 19), l2)
def test_sljustify_one_more_space(self): l = self.l l[0] += ' ' self.assertEqual(b.simple_line_justifying(self.l, 8), l)
def test_sljustify_one_space_per_word(self): l = self.l l[0] += ' ' self.assertEqual(b.simple_line_justifying(self.l, 9), l)
def test_sljustify_exact_width(self): self.assertEqual(b.simple_line_justifying(self.l, 7), self.l)
def test_sljustify_one_word(self): l = ['foo'] self.assertEqual(b.simple_line_justifying(l, 20), l)
def test_sljustify_negative_width(self): self.assertEqual(b.simple_line_justifying(self.l, -42), self.l)
def test_sljustify_too_small_width(self): self.assertEqual(b.simple_line_justifying(self.l, 1), self.l) self.assertEqual(b.simple_line_justifying(self.l, 6), self.l)
def test_sljustify_empty_line(self): self.assertEqual(b.simple_line_justifying([], 0), []) self.assertEqual(b.simple_line_justifying([], 42), [])