def test_scalar_inverse(v: Vector, scalar: float): """Test that (λ * v / λ) ≃ v""" assume(abs(scalar) > 1e-100) assert v.isclose(scalar * v / scalar)
def test_isclose_negative_tolerances(v: Vector): with raises(ValueError): v.isclose(v, abs_tol=-1) with raises(ValueError): v.isclose(v, rel_tol=-1)
def test_reflect_involutive(initial: Vector, normal: Vector): """Test that reflection is its own inverse initial.reflect(normal).reflect(normal) ≃ initial """ assert initial.isclose(initial.reflect(normal).reflect(normal))