Commit 9f4b4fb
fix(openai): Use realistic Choice objects in manual output counting test
The test used MagicMock(message="one") where message was a plain string,
but the real OpenAI API returns Choice objects with message.content. The
counting code checks hasattr(choice.message, "content"), which failed on
strings, so manual token counting was never exercised. Use real Choice
and ChatCompletionMessage objects and fix the expected output_tokens.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d867724 commit 9f4b4fb
1 file changed
+17
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2105 | 2105 | | |
2106 | 2106 | | |
2107 | 2107 | | |
2108 | | - | |
2109 | | - | |
2110 | | - | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
2111 | 2123 | | |
2112 | 2124 | | |
2113 | | - | |
| 2125 | + | |
2114 | 2126 | | |
2115 | 2127 | | |
2116 | 2128 | | |
| |||
2127 | 2139 | | |
2128 | 2140 | | |
2129 | 2141 | | |
2130 | | - | |
| 2142 | + | |
2131 | 2143 | | |
2132 | 2144 | | |
2133 | 2145 | | |
| |||
0 commit comments