Skip to content

Commit b04c182

Browse files
committed
Add tests for trust_input behavior with empty and non-empty inputs
1 parent 200d4c2 commit b04c182

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/compile/function/test_function.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ def test_function_name():
5454
assert regex.match(func.name) is not None
5555

5656

57+
def test_trust_empty_input():
58+
x = shared(1)
59+
f = function([], x + 1)
60+
assert f.trust_input is True
61+
62+
63+
def test_trust_input():
64+
x = dvector()
65+
y = shared(1)
66+
z = x + y
67+
f = function([x], z)
68+
assert f.trust_input is False
69+
f = function([x], z, trust_input=True)
70+
assert f.trust_input is True
71+
72+
5773
class TestFunctionIn:
5874
def test_in_strict(self):
5975
a = dvector()

0 commit comments

Comments
 (0)