def test_other(x, y): """ Write a test that ensures some other property holds for your functions. """ # checking for idempotence assert operators.max(x, y) == operators.max(y, x) assert operators.eq(x, y) == operators.eq(y, x)
def test_same_as_python(x, y): "Check that the main operators all return the same value of the python version" assert_close(mul(x, y), x * y) assert_close(add(x, y), x + y) assert_close(neg(x), -x) assert_close(max(x, y), x if x > y else y) if x != 0.0: assert_close(inv(x), 1.0 / x)
def test_symmetric(x, y): assert op.mul(x, y) == op.mul(y, x) assert op.add(x, y) == op.add(y, x) assert op.max(x, y) == op.max(y, x) assert op.eq(x, y) == op.eq(y, x)
def test_max(a): assert max(a - 1.0, a) == a assert max(a, a - 1.0) == a assert max(a + 1.0, a) == a + 1.0 assert max(a, a + 1.0) == a + 1.0
def test_other(x, y): """ Write a test that ensures some other property holds for your functions. """ assert_close(operators.max(x, y), operators.max(y, x))