Skip to content

Commit 8226eca

Browse files
committed
Identity-check returned values in lexical-reader exposure test
1 parent 324689e commit 8226eca

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

tests/test_handlers_llm_template.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,16 +1655,6 @@ def test_lexical_variable_tool_raises_for_unencodable(name, value):
16551655
_LexicalVariableTool.define(value, name=name)
16561656

16571657

1658-
def test_synthetic_reader_annotation_has_no_free_typevars():
1659-
"""Synthetic reader annotations come from `nested_type`, which
1660-
produces concrete types — TypeVar substitution is a no-op."""
1661-
from effectful.internals.unification import freetypevars
1662-
1663-
tool = _LexicalVariableTool.define([1, 2, 3], name="x")
1664-
sig = inspect.signature(tool)
1665-
assert freetypevars(sig.return_annotation) == set()
1666-
1667-
16681658
# ---- Encodable-passthrough exposure (annotated callables, classes,
16691659
# builtins, methods) ----
16701660

@@ -1739,7 +1729,9 @@ def t(self) -> int:
17391729

17401730

17411731
def test_lexical_reader_exposes_data_values():
1742-
"""Data-shaped values are exposed as readers (positive contract)."""
1732+
"""Data-shaped values are exposed as readers (positive contract).
1733+
Readers snapshot the value, so calling one returns the *same*
1734+
object that was in env at construction time."""
17431735
env = {
17441736
"x": 1,
17451737
"s": "hello",
@@ -1749,8 +1741,8 @@ def test_lexical_reader_exposes_data_values():
17491741
}
17501742
result = _collect_tools(env)
17511743
assert {"x", "s", "lst", "d", "model"} <= set(result)
1752-
assert result["x"]() == 1
1753-
assert result["model"]() == env["model"]
1744+
for k, v in env.items():
1745+
assert result[k]() is v
17541746

17551747

17561748
def test_lexical_reader_doc_mentions_name():

0 commit comments

Comments
 (0)