# Path: hotwing_core/coordinate.py
# class Coordinate():
#     """
#     2 Dimensional X-Y coordinate.
# 
#     Args:
#         x (float): X value of coordinate
#         y (float): Y value of coordinate
# 
#     :ivar x: x coordinate
#     :ivar y: y coordinate
#     """
#     def __init__(self, x, y):
#         self.x = x
#         self.y = y
# 
#     @classmethod
#     def calc_dist(cls, a, b):
#         """
#         Calculate the distance between two Coordinates.
# 
#         Args:
#             a (Coordinate): First Coordinate
#             b (Coordinate): Second Coordinate
#         Returns:
#             Float: Distance between c1 and c2
# 
#         """
#         dist = math.sqrt((a.x-b.x)**2+(a.y-b.y)**2)
#         return dist
# 
#     @classmethod
#     def calc_slope(cls, a, b):
#         """
#         Calculate the slope between two Coordinates.
# 
#         Args:
#             a (Coordinate): First Coordinate
#             b (Coordinate): Second Coordinate
#         Returns:
#             Float: Slope between a and b
#         """
#         try:
#             slope = (a.y-b.y) / (a.x-b.x)
#         except ZeroDivisionError:
#             # same x val -> infinite slope
#             slope = float('inf')
#         return slope
# 
#     @classmethod
#     def rotate(cls, origin, coordinate, angle):
#         """
#         Rotate a Coordinate around a point in 2D space.
# 
#         Args:
#             origin (Coordinate) : Defines the point to rotate around
#             coordinate (Coordinate): The Coordinate to rotate
#             angle (Float) : Degrees to rotate Coordinate
# 
#         Returns:
#             Coordinate: New rotated Coordinate
#         """
#         angle = math.radians(angle)
#         ox = origin.x
#         oy = origin.y
#         px = coordinate.x
#         py = coordinate.y
# 
#         qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy)
#         qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy)
#         return cls(qx, qy)
# 
#     def __str__(self):
#         return "%.5f, %.5f" % (self.x, self.y)
# 
#     def __repr__(self):
#         return "Coordinate: %.5f, %.5f" % (self.x, self.y)
# 
#     def __eq__(self, other):
#         """
#         Compare two a Coordinate objects
#         """
#         # comparison tolerance - necessary due to the rounding
#         # error with floating point numbers 
#         tolerance = 0.00000001
# 
#         if isinstance(other, self.__class__):
#             if abs(self.x - other.x) >= tolerance:
#                 return False
#             if abs(self.y - other.y) >= tolerance:
#                 return False
#             return True
#         raise NotImplementedError
# 
#     def __ne__(self, other):
#         """
#         Compare two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return not self.__eq__(other)
#         raise NotImplementedError
# 
#     def __add__(self, other):
#         """
#         Add two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return Coordinate(self.x+other.x, self.y+other.y)
#         raise NotImplementedError
# 
#     def __sub__(self, other):
#         """
#         Subtract two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return Coordinate(self.x-other.x, self.y-other.y)
#         raise NotImplementedError
# 
#     def __mul__(self, other):
#         """
#         Multiply two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return Coordinate(self.x*other.x, self.y*other.y)
#         return Coordinate(self.x*other, self.y*other)


import pytest
import sys, os
from decimal import Decimal
from hotwing_core import Coordinate
        a = 360
        e = c
        r = Coordinate.rotate(o,c,a)
        assert e == r

    def test_add(self):
        c1 = Coordinate(1, 2)
        c2 = Coordinate(3, 4)
        e = Coordinate(1+3,2+4)
        assert c1+c2 == e

        with pytest.raises(NotImplementedError):
            c1 + 1

    def test_subtract(self):
        c1 = Coordinate(1, 2)
        c2 = Coordinate(3, 4)
        e = Coordinate(1-3,2-4)
        assert c1-c2 == e

        with pytest.raises(NotImplementedError):
            c1 - 1

    def test_multiply(self):
        c1 = Coordinate(0, 1)
        c2 = Coordinate(2, 3)
        assert c1*c2 == Coordinate(0*2,1*3)

        # test with numeric objects
        assert c1*2 == Coordinate(0*2,1*2)

# Path: hotwing_core/coordinate.py
# class Coordinate():
#     """
#     2 Dimensional X-Y coordinate.
# 
#     Args:
#         x (float): X value of coordinate
#         y (float): Y value of coordinate
# 
#     :ivar x: x coordinate
#     :ivar y: y coordinate
#     """
#     def __init__(self, x, y):
#         self.x = x
#         self.y = y
# 
#     @classmethod
#     def calc_dist(cls, a, b):
#         """
#         Calculate the distance between two Coordinates.
# 
#         Args:
#             a (Coordinate): First Coordinate
#             b (Coordinate): Second Coordinate
#         Returns:
#             Float: Distance between c1 and c2
# 
#         """
#         dist = math.sqrt((a.x-b.x)**2+(a.y-b.y)**2)
#         return dist
# 
#     @classmethod
#     def calc_slope(cls, a, b):
#         """
#         Calculate the slope between two Coordinates.
# 
#         Args:
#             a (Coordinate): First Coordinate
#             b (Coordinate): Second Coordinate
#         Returns:
#             Float: Slope between a and b
#         """
#         try:
#             slope = (a.y-b.y) / (a.x-b.x)
#         except ZeroDivisionError:
#             # same x val -> infinite slope
#             slope = float('inf')
#         return slope
# 
#     @classmethod
#     def rotate(cls, origin, coordinate, angle):
#         """
#         Rotate a Coordinate around a point in 2D space.
# 
#         Args:
#             origin (Coordinate) : Defines the point to rotate around
#             coordinate (Coordinate): The Coordinate to rotate
#             angle (Float) : Degrees to rotate Coordinate
# 
#         Returns:
#             Coordinate: New rotated Coordinate
#         """
#         angle = math.radians(angle)
#         ox = origin.x
#         oy = origin.y
#         px = coordinate.x
#         py = coordinate.y
# 
#         qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy)
#         qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy)
#         return cls(qx, qy)
# 
#     def __str__(self):
#         return "%.5f, %.5f" % (self.x, self.y)
# 
#     def __repr__(self):
#         return "Coordinate: %.5f, %.5f" % (self.x, self.y)
# 
#     def __eq__(self, other):
#         """
#         Compare two a Coordinate objects
#         """
#         # comparison tolerance - necessary due to the rounding
#         # error with floating point numbers 
#         tolerance = 0.00000001
# 
#         if isinstance(other, self.__class__):
#             if abs(self.x - other.x) >= tolerance:
#                 return False
#             if abs(self.y - other.y) >= tolerance:
#                 return False
#             return True
#         raise NotImplementedError
# 
#     def __ne__(self, other):
#         """
#         Compare two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return not self.__eq__(other)
#         raise NotImplementedError
# 
#     def __add__(self, other):
#         """
#         Add two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return Coordinate(self.x+other.x, self.y+other.y)
#         raise NotImplementedError
# 
#     def __sub__(self, other):
#         """
#         Subtract two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return Coordinate(self.x-other.x, self.y-other.y)
#         raise NotImplementedError
# 
#     def __mul__(self, other):
#         """
#         Multiply two a Coordinate objects
#         """
#         if isinstance(other, self.__class__):
#             return Coordinate(self.x*other.x, self.y*other.y)
#         return Coordinate(self.x*other, self.y*other)


# Path: tests/test_coordinate.py
import pytest
import sys, os
from decimal import Decimal
from hotwing_core import Coordinate

        a = 360
        e = c
        r = Coordinate.rotate(o,c,a)
        assert e == r

    def test_add(self):
        c1 = Coordinate(1, 2)
        c2 = Coordinate(3, 4)
        e = Coordinate(1+3,2+4)
        assert c1+c2 == e

        with pytest.raises(NotImplementedError):
            c1 + 1

    def test_subtract(self):
        c1 = Coordinate(1, 2)
        c2 = Coordinate(3, 4)
        e = Coordinate(1-3,2-4)
        assert c1-c2 == e

        with pytest.raises(NotImplementedError):
            c1 - 1

    def test_multiply(self):
        c1 = Coordinate(0, 1)
        c2 = Coordinate(2, 3)
        assert c1*c2 == Coordinate(0*2,1*3)

        # test with numeric objects
        assert c1*2 == Coordinate(0*2,1*2)

        assert c1*2 == Coordinate(0*float(2),1*float(2))