Freeze mutable values nested inside tuple arguments
This commit is contained in:
parent
5e819525db
commit
32df6504cc
1 changed files with 23 additions and 0 deletions
17
tests/test_cache_regressions.py
Normal file
17
tests/test_cache_regressions.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from typing import Dict, Tuple
|
||||
|
||||
from great_ai import GreatAI
|
||||
|
||||
|
||||
def test_nested_tuple_inputs_can_be_cached(isolated_context: None) -> None:
|
||||
calls = 0
|
||||
|
||||
@GreatAI.create
|
||||
def predict(value: Tuple[Dict[str, int]]) -> int:
|
||||
nonlocal calls
|
||||
calls += 1
|
||||
return value[0]["x"]
|
||||
|
||||
assert predict(({"x": 7},)).output == 7
|
||||
assert predict(({"x": 7},)).output == 7
|
||||
assert calls == 1
|
||||
Loading…
Reference in a new issue