def test_Nose__add__(a, b, c): """ the properties are taken from here: http://hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html#t:Num """ assert round_Part((a + b) + c) == round_Part(a + (b + c)) assert a + b == b + a assert a + Nose.default() == a assert a + -a == Nose(Coord(0, 0), Coord(0, 0), Coord(0, 0))
def test_Nose__init__(a, b, c): nose = Nose(a, b, c) assert nose.bottom == a assert nose.top == Coord(0, 0) assert nose.leftSide == b assert nose.rightSide == c
def test_Face_default(): assert Face.default() == Face(AbsoluteCoord.default(), RelativeCoord.default(), RelativeCoord.default(), RelativeCoord.default(), Eye.default(), Eye.default(), Mouth.default(), Nose.default(), EyeBrow.default(), EyeBrow.default())
def test_Face_fromDPoints(): points = dlib.dpoints([dlib.dpoint(x, x) for x in range(194)]) # Those values are defined in LANDMARK_NUM correct = Face( AbsoluteCoord(49.0, 49.0), RelativeCoord(0.0, 0.0), RelativeCoord(40.0, 40.0), RelativeCoord(19.0, 19.0), Eye(Coord(129.0, 129.0), Coord(120.0, 120.0), Coord(124.0, 124.0), Coord(114.0, 114.0)), Eye(Coord(149.0, 149.0), Coord(140.0, 140.0), Coord(135.0, 135.0), Coord(145.0, 145.0)), Mouth(Coord(79.0, 79.0), Coord(65.0, 65.0), Coord(71.0, 71.0), Coord(58.0, 58.0)), Nose(Coord(49.0, 49.0), Coord(54.0, 54.0), Coord(44.0, 44.0)), EyeBrow(Coord(169.0, 169.0), Coord(159.0, 159.0), Coord(164.0, 164.0), Coord(154.0, 154.0)), EyeBrow(Coord(190.0, 190.0), Coord(179.0, 179.0), Coord(174.0, 174.0), Coord(185.0, 185.0))) assert Face.fromDPoints(points) == correct
CoordStrategies), st.builds(Mouth, CoordStrategies, CoordStrategies, CoordStrategies, CoordStrategies), st.builds(Nose, CoordStrategies, CoordStrategies, CoordStrategies), st.builds(EyeBrow, CoordStrategies, CoordStrategies, CoordStrategies, CoordStrategies), st.builds(EyeBrow, CoordStrategies, CoordStrategies, CoordStrategies, CoordStrategies)) face_front = Face( AbsoluteCoord(0, 0), RelativeCoord(25, 30), RelativeCoord(-25, 30), RelativeCoord(0, -50), Eye(Coord(10, 20), Coord(0, 0), Coord(0, 0), Coord(3, 25)), Eye(Coord(-10, 20), Coord(0, 0), Coord(-3, 25), Coord(0, 0)), Mouth(Coord(0, 0), Coord(0, 0), Coord(0, 0), Coord(0, 0)), Nose(Coord(0, 0), Coord(0, 0), Coord(0, 0)), EyeBrow(Coord(0, 0), Coord(0, 0), Coord(0, 0), Coord(5, 50)), EyeBrow(Coord(0, 0), Coord(0, 0), Coord(-5, 50), Coord(0, 0))) face_right = Face( AbsoluteCoord(-3, 0), RelativeCoord(20, 30), RelativeCoord(-25, 30), RelativeCoord(-2.5, -50), Eye(Coord(5, 20), Coord(0, 0), Coord(0, 0), Coord(2, 25)), Eye(Coord(-6, 20), Coord(0, 0), Coord(-3, 25), Coord(0, 0)), Mouth(Coord(0, 0), Coord(0, 0), Coord(0, 0), Coord(0, 0)), Nose(Coord(0, 0), Coord(0, 0), Coord(0, 0)), EyeBrow(Coord(0, 0), Coord(0, 0), Coord(0, 0), Coord(0, 50)), EyeBrow(Coord(0, 0), Coord(0, 0), Coord(-5, 50), Coord(0, 0))) face_left = Face(AbsoluteCoord(3, 0), RelativeCoord(25, 30), RelativeCoord(-20, 30), RelativeCoord(2.5, -50), Eye(Coord(10, 20), Coord(0, 0), Coord(0, 0), Coord(3, 25)), Eye(Coord(-5, 20), Coord(0, 0), Coord(-2, 25), Coord(0, 0)),
def test_Nose_default(): assert Nose.default() == Nose(Coord(0, 0), Coord(0, 0), Coord(0, 0))
def test_Nose__sub__(a): assert a - a == Nose(Coord(0, 0), Coord(0, 0), Coord(0, 0))