def test_calling_conventions(): array = np.array([1.0, 2.5, 4.3]) # Without decorators a = jit(f) # guess signature from args assert not a.compiled a(array) assert a.compiled c = jit(f, signature) # pass signature assert c.compiled b = jit(f_hints) # with type hints assert b.compiled assert a(array) == b(array) == c(array) # compare # With decorators assert not f_dec.compiled # guess signature from args f_dec(array) assert f_dec.compiled assert f_dec_sig.compiled # with signature assert f_dec_hints.compiled # with type hints assert f_dec(array) == f_dec_sig(array) == f_dec_hints(array) assert a(array) == f_dec(array)
def test_ndim(f, a): fc = jit(f) assert f(a) == fc(a)
def test_np_loop(f, a): fc = jit(f) assert fc(a) == f(a)
def test_for(f): f = jit(f) assert f() == f.py_function()
def test_out(f, a, b): fc = jit(f) assert f(a, b) == fc(a, b)
def test_int(f, x): fc = jit(f) assert f(x) == fc(x)
def test_return(f): fc = jit(f) assert fc.py_function is f assert f() == fc()
def test_none(f): fc = jit(f) assert fc.py_function is f assert fc() is None
def test_inference(f): fc = jit(f) assert f() == fc()