def test_isub(x1, y1, x2, y2): a = VectorNumpy(x1, y1) b = VectorNumpy(x2, y2) c = a.copy() a -= b assert a.x == c.x - b.x assert a.y == c.y - b.y if x1 != 0 and x2 != 0: assert a.x != x2 if y1 != 0 and y2 != 0: assert a.y != y2 a -= VectorNumpy(1, 1) assert a.x == c.x - b.x - 1 assert a.y == c.y - b.y - 1
def test_iadd(x1, y1, x2, y2): a = VectorNumpy(x1, y1) b = VectorNumpy(x2, y2) c = a.copy() a += b assert a.x == c.x + b.x assert a.y == c.y + b.y if x1 != 0 and x2 != 0: assert a.x != x2 if y1 != 0 and y2 != 0: assert a.y != y2 a += VectorNumpy(1, 1) assert a.x == c.x + b.x + 1 assert a.y == c.y + b.y + 1