def test_create_rect_from_corners(self):
     '''Test for Rectangle.from_corners()'''
     rect = Rectangle.from_corners(0, 1, 2, 4)
     self.assertEqual(rect.x, 0)
     self.assertEqual(rect.y, 1)
     self.assertEqual(rect.width, 2)
     self.assertEqual(rect.height, 3)
 def parse_box(self, args):
     """ Returns a parsed box. """
     x1, y1, x2, y2 = [int(a) for a in args.split()]
     return ('shape', Rectangle.from_corners(x1, y1, x2, y2))
Example #3
0
 def parse_box(self, args):
     """ Returns a parsed box. """
     x1, y1, x2, y2 = [int(a) for a in args.split()]
     return ('shape', Rectangle.from_corners(x1, y1, x2, y2))