Beispiel #1
0
 def test_horizontal_line_backwards(self):
     drawing = line(5, 1, 0, 1, W, H, BASE_CANVAS)
     self.assertEqual(
         pretty_render(W, H, drawing),
         textwrap.dedent("""
     +--------------------+
     |                    |
     |xxxxxx              |
     |                    |
     |                    |
     +--------------------+
     """))
Beispiel #2
0
 def test_vertical_line(self):
     drawing = line(5, 2, 5, 3, W, H, BASE_CANVAS)
     self.assertEqual(
         pretty_render(W, H, drawing),
         textwrap.dedent("""
     +--------------------+
     |                    |
     |                    |
     |     x              |
     |     x              |
     +--------------------+
     """))
Beispiel #3
0
 def test_diagonal_line(self):
     with self.assertRaises(ValueError):
         line(1, 2, 6, 4, W, H, BASE_CANVAS)
Beispiel #4
0
 def base_drawing(self, *args):
     l1 = lambda c: line(0, 1, 5, 1, W, H, c)
     l2 = lambda c: line(5, 2, 5, 3, W, H, c)
     rc = lambda c: rect(15, 0, 19, 2, W, H, c)
     return reduce(lambda d, fn: fn(d), (l1, l2, rc) + args, BASE_CANVAS)