(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func TestImageGenerationCompatibilityWarning(t *testing.T) { |
| 170 | // Save original stderr to restore later |
| 171 | originalStderr := os.Stderr |
| 172 | defer func() { |
| 173 | os.Stderr = originalStderr |
| 174 | }() |
| 175 | |
| 176 | tests := []struct { |
| 177 | name string |
| 178 | model string |
| 179 | imageFile string |
| 180 | expectWarning bool |
| 181 | warningSubstr string |
| 182 | description string |
| 183 | }{ |
| 184 | { |
| 185 | name: "Compatible model with image", |
| 186 | model: "gpt-4o", |
| 187 | imageFile: "test.png", |
| 188 | expectWarning: false, |
| 189 | description: "Should not warn for compatible model", |
| 190 | }, |
| 191 | { |
| 192 | name: "Incompatible model with image", |
| 193 | model: "o1-mini", |
| 194 | imageFile: "test.png", |
| 195 | expectWarning: true, |
| 196 | warningSubstr: "Warning: Model 'o1-mini' does not support image generation", |
| 197 | description: "Should warn for incompatible model", |
| 198 | }, |
| 199 | { |
| 200 | name: "Incompatible model without image", |
| 201 | model: "o1-mini", |
| 202 | imageFile: "", |
| 203 | expectWarning: false, |
| 204 | description: "Should not warn when no image file specified", |
| 205 | }, |
| 206 | { |
| 207 | name: "Compatible model without image", |
| 208 | model: "gpt-4o-mini", |
| 209 | imageFile: "", |
| 210 | expectWarning: false, |
| 211 | description: "Should not warn when no image file specified even for compatible model", |
| 212 | }, |
| 213 | { |
| 214 | name: "Another incompatible model with image", |
| 215 | model: "gpt-3.5-turbo", |
| 216 | imageFile: "output.jpg", |
| 217 | expectWarning: true, |
| 218 | warningSubstr: "Warning: Model 'gpt-3.5-turbo' does not support image generation", |
| 219 | description: "Should warn for different incompatible model", |
| 220 | }, |
| 221 | } |
| 222 | |
| 223 | for _, tt := range tests { |
| 224 | t.Run(tt.name, func(t *testing.T) { |
| 225 | // Note: In a real integration test, we would capture stderr like this: |
| 226 | // stderrCapture := &bytes.Buffer{} |
nothing calls this directly
no outgoing calls
no test coverage detected