def test_yOrder_withEqualYCoordinatePoints_shouldReturnZero(self): for i in range(500): y = random.uniform(0, 1000) a = Point2D( 1, y) b = Point2D(-1, y) self.assertEqual(0, Point2D.y_order(a, b)) self.assertEqual(0, Point2D.y_order(b, a))
def test_yOrder_withNotEqualYCoordinatePoints_shouldReturnCorrectComparatorResult(self): for i in range(500): ya = random.uniform(0, 1000) yb = random.uniform(-1000, -1) a = Point2D( 1, ya) b = Point2D(-1, yb) self.assertEqual( 1, Point2D.y_order(a, b)) self.assertEqual(-1, Point2D.y_order(b, a))