@@ -105,6 +105,12 @@ function constructModelWithAllNVP(testCase)
105
105
testCase .verifyEqual(mdl .ModelName , modelName );
106
106
end
107
107
108
+ function fakePNGImage(testCase )
109
+ mdl = openAIImages(ApiKey = " this-is-not-a-real-key" );
110
+ fakePng = fullfile(" test_files" , " solar.png" );
111
+ testCase .verifyError(@()edit(mdl ,fakePng , " bla" ), " llms:pngExpected" );
112
+ end
113
+
108
114
function invalidInputsConstructor(testCase , InvalidConstructorInput )
109
115
testCase .verifyError(@()openAIImages(InvalidConstructorInput.Input{: }), InvalidConstructorInput .Error );
110
116
end
@@ -157,11 +163,15 @@ function invalidInputsVariation(testCase, InvalidVariationInput)
157
163
invalidGenerateInput = struct( ...
158
164
" EmptyInput" ,struct( ...
159
165
" Input" ,{{ [] }},...
160
- " Error" ," MATLAB:validators:mustBeTextScalar " ),...
166
+ " Error" ," MATLAB:validators:mustBeNonzeroLengthText " ),...
161
167
...
162
168
" InvalidInputType" ,struct( ...
163
169
" Input" ,{{ 123 }},...
164
- " Error" ," MATLAB:validators:mustBeTextScalar" ),...
170
+ " Error" ," MATLAB:validators:mustBeNonzeroLengthText" ),...
171
+ ...
172
+ " InvalidPromptLen" ,struct( ...
173
+ " Input" ,{{ " " }},...
174
+ " Error" ," MATLAB:validators:mustBeNonzeroLengthText" ),...
165
175
...
166
176
" InvalidNumImagesType" ,struct( ...
167
177
" Input" ,{{ " prompt" " NumImages" " 2" }},...
@@ -233,17 +243,21 @@ function invalidInputsVariation(testCase, InvalidVariationInput)
233
243
" Input" ,{{ 123 , " prompt" }},...
234
244
" Error" ," MATLAB:validators:mustBeNonzeroLengthText" ),...
235
245
...
246
+ " InvalidPromptLen" ,struct( ...
247
+ " Input" ,{{ validImage , " " }},...
248
+ " Error" ," MATLAB:validators:mustBeNonzeroLengthText" ),...
249
+ ...
236
250
" InvalidImageExtension" ,struct( ...
237
251
" Input" ,{{ nonPNGImage , " prompt" }},...
238
252
" Error" ," llms:pngExpected" ),...
239
253
...
240
254
" EmptyPrompt" ,struct( ...
241
255
" Input" ,{{ validImage , [] }},...
242
- " Error" ," MATLAB:validators:mustBeTextScalar " ),...
256
+ " Error" ," MATLAB:validators:mustBeNonzeroLengthText " ),...
243
257
...
244
258
" InvalidPromptType" ,struct( ...
245
259
" Input" ,{{ validImage , 123 }},...
246
- " Error" ," MATLAB:validators:mustBeTextScalar " ),...
260
+ " Error" ," MATLAB:validators:mustBeNonzeroLengthText " ),...
247
261
...
248
262
" InvalidMaskImage" ,struct( ...
249
263
" Input" ,{{ validImage , " foo" , " MaskImagePath" , 123 }},...
0 commit comments