def test_givenTwoShapesWithSameContourWhenComparedThenTheyAreEqual(self): myContour = np.array([[[1,1]],[[10,50]],[[50,50]]], dtype=np.int32) aGeometricalName = "Triangle" myFirstShape = Shape(aGeometricalName, myContour) mySecondShape = Shape(aGeometricalName, myContour) self.assertTrue(myFirstShape == mySecondShape)
def test_givenTwoShapesWithDifferentContourWhenComparedThenTheyAreNotEqual(self): myFirstContour = np.array([[[1,1]],[[10,50]],[[50,50]]], dtype=np.int32) mySecondContour = np.array([[1,2],[10,51],[50,52]], dtype=np.int32) aGeometricalName = "Triangle" myFirstShape = Shape(aGeometricalName, myFirstContour) mySecondShape = Shape(aGeometricalName, mySecondContour) self.assertFalse(myFirstShape == mySecondShape)
def setUp(self): geometricalName = "Square" firstContour = np.array([[[1,1]], [[1,2]], [[2,2]], [[2, 1]]], dtype=np.int32) secondContour = np.array([[[0,0]], [[2,3]], [[3,3]], [[3, 2]]], dtype=np.int32) differentContour = np.array([[[124,132]], [[134,132]], [[134,155]], [[124, 155]]], dtype=np.int32) self.firstShape = Shape(geometricalName, firstContour) self.secondShape = Shape(geometricalName, secondContour) self.differentShape = Shape(geometricalName, differentContour)
def test_givenTwoShapeWithOneNotIniTializeWhenComparedThenTheyAreNotEqual(self): myFirstContour = np.array([[[1,1]],[[10,50]],[[50,50]]], dtype=np.int32) aGeometricalName = "Triangle" myFirstShape = Shape(aGeometricalName, myFirstContour) mySecondShape = None self.assertFalse(myFirstShape == mySecondShape)
def test_givenAShapeWithDifferentLenghtEdgesWhenIsEqualEdgesThenEdgesAreNotEquals(self): squareContour = np.array([[[0,0]], [[0,1]], [[1,30]]], dtype=np.int32) aGeometricalName = "Square" myShape = Shape(aGeometricalName, squareContour) self.assertFalse(myShape.isEqualEdges())
def test_givenAShapeWithSimilarLenghtEdgesWhenIsEqualEdgesThenEdgesAreEquals(self): squareContour = np.array([[[0,0]], [[0,1]], [[1,0]], [[1,1]]], dtype=np.int32) aGeometricalName = "Square" myShape = Shape(aGeometricalName, squareContour) self.assertTrue(myShape.isEqualEdges())