@@ -253,18 +253,6 @@ async def ret_a(x: str) -> str:
253253 assert result .usage () == snapshot (RunUsage (requests = 2 , input_tokens = 103 , output_tokens = 14 , tool_calls = 1 ))
254254
255255
256- def test_deprecated_usage_limits ():
257- with warns (
258- snapshot (['DeprecationWarning: `request_tokens_limit` is deprecated, use `input_tokens_limit` instead' ])
259- ):
260- assert UsageLimits (input_tokens_limit = 100 ).request_tokens_limit == 100 # type: ignore
261-
262- with warns (
263- snapshot (['DeprecationWarning: `response_tokens_limit` is deprecated, use `output_tokens_limit` instead' ])
264- ):
265- assert UsageLimits (output_tokens_limit = 100 ).response_tokens_limit == 100 # type: ignore
266-
267-
268256async def test_output_tool_not_counted () -> None :
269257 """Test that output tools are not counted in tool_calls usage metric."""
270258 test_agent = Agent (TestModel ())
@@ -308,3 +296,15 @@ async def flaky_tool(x: str) -> str:
308296 # The tool was called twice (1 failure + 1 success), but only the successful call should be counted
309297 assert call_count == 2
310298 assert result .usage () == snapshot (RunUsage (requests = 3 , input_tokens = 176 , output_tokens = 29 , tool_calls = 1 ))
299+
300+
301+ def test_deprecated_usage_limits ():
302+ with warns (
303+ snapshot (['DeprecationWarning: `request_tokens_limit` is deprecated, use `input_tokens_limit` instead' ])
304+ ):
305+ assert UsageLimits (input_tokens_limit = 100 ).request_tokens_limit == 100 # type: ignore
306+
307+ with warns (
308+ snapshot (['DeprecationWarning: `response_tokens_limit` is deprecated, use `output_tokens_limit` instead' ])
309+ ):
310+ assert UsageLimits (output_tokens_limit = 100 ).response_tokens_limit == 100 # type: ignore
0 commit comments