def __getMirrorFocus(self, center, focus): Validator.validatePoint(center, "Center point invalid") Validator.validatePoint(focus, "Focus point invalid") dx = focus.x - center.x dy = focus.y - center.y x = focus.x - dx * 2 y = focus.y - dy * 2 return Point(x, y)
def __constructWithPoints(self, point1, point2): try: Validator.validatePoint(point1, "Invalid point1") Validator.validatePoint(point2, "Invalid point2") self.__point1 = point1 self.__point2 = point2 Validator.validateLine(value=self, errorMessage="Line invalid") return True except ShapeException: return False
def testValidatePoint(self): p1 = Point(1, 1) Validator.validatePoint(p1, "Point unexpectedly invalid") self.assertRaises(ShapeException, Validator.validatePoint, "(1, 1)", "String \'(1, 1)\' is not a valid point")
def __constructWithCoords(self, x1, y1): self.__x = x1 self.__y = y1 Validator.validatePoint(value=self, errorMessage="Point construction failed")