2727 pytest_helper .TestTableItem (
2828 name = 'test_image_generation_config' ,
2929 parameters = types ._GenerateContentParameters (
30- model = 'gemini-2.5-flash-image-preview ' ,
30+ model = 'gemini-2.5-flash-image' ,
3131 contents = t .t_contents ('A photorealistic red apple on a table.' ),
3232 config = types .GenerateContentConfig (
3333 response_modalities = ["IMAGE" ],
4040 pytest_helper .TestTableItem (
4141 name = 'test_image_generation_filtered' ,
4242 parameters = types ._GenerateContentParameters (
43- model = 'gemini-2.5-flash-image-preview ' ,
43+ model = 'gemini-2.5-flash-image' ,
4444 contents = t .t_contents ('Make a zombie anime style' ),
4545 config = types .GenerateContentConfig (
46- response_modalities = [" IMAGE" ],
46+ response_modalities = [' IMAGE' ],
4747 image_config = types .ImageConfig (
4848 aspect_ratio = '16:9' ,
4949 )
5050 ),
5151 ),
5252 ),
53+ pytest_helper .TestTableItem (
54+ name = 'test_image_generation_config_validation_none' ,
55+ parameters = types ._GenerateContentParameters (
56+ model = 'gemini-2.5-flash-image' ,
57+ contents = t .t_contents ('A photorealistic red apple on a table.' ),
58+ config = types .GenerateContentConfig (
59+ response_modalities = ['IMAGE' ],
60+ image_config = None
61+ ),
62+ ),
63+ ),
5364]
5465
5566
6475def test_image_generation_wrong_config (client ):
6576 with pytest .raises (pydantic .ValidationError ):
6677 client .models .generate_content (
67- model = 'gemini-2.5-flash-image-preview ' ,
78+ model = 'gemini-2.5-flash-image' ,
6879 contents = t .t_contents ('A photorealistic red apple on a table.' ),
6980 config = types .GenerateContentConfig (
7081 response_modalities = ["IMAGE" ],
@@ -74,3 +85,16 @@ def test_image_generation_wrong_config(client):
7485 )
7586 ),
7687 )
88+
89+
90+ def test_image_generation_validation_model_dump (client ):
91+ config = types .GenerateContentConfig (
92+ response_modalities = ['IMAGE' ],
93+ )
94+
95+ class Foo (pydantic .BaseModel ):
96+ value : types .GenerateContentConfig
97+
98+ f = Foo (value = config )
99+ in_memory = f .model_dump (mode = 'json' )
100+ Foo .model_validate (in_memory )
0 commit comments