fix: use explicit token limits in tests to decouple from global constant

This commit is contained in:
Kevin Turcios 2026-02-12 01:02:21 -05:00
parent be4a2ca09e
commit 9e904483d8

View file

@ -813,7 +813,7 @@ class HelperClass:
ending_line=None,
)
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root)
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root, optim_token_limit=16000)
read_write_context, read_only_context = code_ctx.read_writable_code, code_ctx.read_only_context_code
hashing_context = code_ctx.hashing_code_context
# In this scenario, the read-only code context is too long, so the read-only docstrings are removed.
@ -1006,7 +1006,7 @@ class HelperClass:
)
# In this scenario, the read-writable code is too long, so we abort.
with pytest.raises(ValueError, match="Read-writable code has exceeded token limit, cannot proceed"):
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root)
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root, optim_token_limit=16000)
def test_example_class_token_limit_4(tmp_path: Path) -> None:
@ -1059,7 +1059,7 @@ class HelperClass:
# In this scenario, the read-writable code context becomes too large because the __init__ function is referencing the global x variable instead of the class attribute self.x, so we abort.
with pytest.raises(ValueError, match="Read-writable code has exceeded token limit, cannot proceed"):
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root)
code_ctx = get_code_optimization_context(function_to_optimize, opt.args.project_root, optim_token_limit=16000)
def test_example_class_token_limit_5(tmp_path: Path) -> None: