SIGN IN SIGN UP
langflow-ai / langflow UNCLAIMED

Langflow is a powerful tool for building and deploying AI-powered agents and workflows.

146432 0 0 Python

test: add missing unit tests from PR review

Adds the 4 recommended test scenarios identified in Cristhianzl's review
of PR #11891 (token usage tracking):

- TestStreamingTokenAccumulation: verifies extract_usage_from_chunk() +
  accumulate_usage() correctly accumulates across multiple streaming chunks
  (OpenAI, Anthropic, and usage_metadata formats)
- TestChatOutputTokenUsageAccumulation: verifies message_response() sets
  upstream token usage on the message and updates the stored message when
  applicable
- TestAgentTokenCallbackWiring: verifies TokenUsageCallbackHandler is wired
  into run_agent() callbacks and its result is stored on _token_usage
- TestResultDataResponseTokenUsageValidator: verifies the field_validator
  converts Usage Pydantic models to dicts and passes through None/dict values
V
Viktor Avelino committed
5e60bfbd677189f9bfbf942753c6b3009d62466e
Parent: a0834df