def test_pin_bounds(self): '''Test bounds() for individual pins''' pin = Pin(0, Point(2, 5), Point(4, 3)) top_left, bottom_right = pin.bounds() self.assertEqual(top_left.x, 2) self.assertEqual(top_left.y, 3) self.assertEqual(bottom_right.x, 4) self.assertEqual(bottom_right.y, 5)
def test_pin_label_bounds(self): '''Test bounds() for a pin with a label''' lab = Label(0, 0, 'foo', align='left', rotation=0) mkbounds(lab, 1, 3, 2, 6) pin = Pin(0, Point(2, 2), Point(4, 3), lab) top_left, bottom_right = pin.bounds() self.assertEqual(top_left.x, 1) self.assertEqual(top_left.y, 2) self.assertEqual(bottom_right.x, 4) self.assertEqual(bottom_right.y, 6)