Skip to content

Commit 3bd5d0a

Browse files
fix v0 tests, non-azure openai won't accept api_version (#33511)
1 parent 9fa4306 commit 3bd5d0a

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

sdk/openai/azure-openai/tests/v0_tests/test_dall_e_v0.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class TestDallE(AzureRecordedTestCase):
1414
@pytest.mark.parametrize("api_type", ALL)
1515
@configure_v0
1616
def test_image_create(self, set_vars, azure_openai_creds, api_type):
17-
openai.api_version = "2023-10-01-preview" # not supported by later versions
17+
if api_type != OPENAI:
18+
openai.api_version = "2023-10-01-preview" # not supported by later versions
1819
image = openai.Image.create(
1920
prompt="a cute baby seal"
2021
)
@@ -25,7 +26,8 @@ def test_image_create(self, set_vars, azure_openai_creds, api_type):
2526
@pytest.mark.parametrize("api_type", [AZURE, OPENAI])
2627
@configure_v0
2728
def test_image_create_n(self, set_vars, azure_openai_creds, api_type):
28-
openai.api_version = "2023-10-01-preview" # not supported by later versions
29+
if api_type != OPENAI:
30+
openai.api_version = "2023-10-01-preview" # not supported by later versions
2931
image = openai.Image.create(
3032
prompt="a cute baby seal",
3133
n=2
@@ -38,7 +40,8 @@ def test_image_create_n(self, set_vars, azure_openai_creds, api_type):
3840
@pytest.mark.parametrize("api_type", [AZURE, OPENAI])
3941
@configure_v0
4042
def test_image_create_size(self, set_vars, azure_openai_creds, api_type):
41-
openai.api_version = "2023-10-01-preview" # not supported by later versions
43+
if api_type != OPENAI:
44+
openai.api_version = "2023-10-01-preview" # not supported by later versions
4245
image = openai.Image.create(
4346
prompt="a cute baby seal",
4447
size="256x256"
@@ -61,7 +64,8 @@ def test_image_create_response_format(self, set_vars, azure_openai_creds, api_ty
6164
@pytest.mark.parametrize("api_type", [AZURE, OPENAI])
6265
@configure_v0
6366
def test_image_create_user(self, set_vars, azure_openai_creds, api_type):
64-
openai.api_version = "2023-10-01-preview" # not supported by later versions
67+
if api_type != OPENAI:
68+
openai.api_version = "2023-10-01-preview" # not supported by later versions
6569
image = openai.Image.create(
6670
prompt="a cute baby seal",
6771
user="krista"

sdk/openai/azure-openai/tests/v0_tests/test_dall_e_v0_async.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class TestDallEAsync(AzureRecordedTestCase):
1515
@pytest.mark.parametrize("api_type", ALL)
1616
@configure_v0_async
1717
async def test_image_create(self, set_vars, azure_openai_creds, api_type):
18-
openai.api_version = "2023-10-01-preview" # not supported by later versions
18+
if api_type != OPENAI:
19+
openai.api_version = "2023-10-01-preview" # not supported by later versions
1920
image = await openai.Image.acreate(
2021
prompt="a cute baby seal"
2122
)
@@ -27,7 +28,8 @@ async def test_image_create(self, set_vars, azure_openai_creds, api_type):
2728
@pytest.mark.parametrize("api_type", [AZURE, OPENAI])
2829
@configure_v0_async
2930
async def test_image_create_n(self, set_vars, azure_openai_creds, api_type):
30-
openai.api_version = "2023-10-01-preview" # not supported by later versions
31+
if api_type != OPENAI:
32+
openai.api_version = "2023-10-01-preview" # not supported by later versions
3133
image = await openai.Image.acreate(
3234
prompt="a cute baby seal",
3335
n=2
@@ -41,7 +43,8 @@ async def test_image_create_n(self, set_vars, azure_openai_creds, api_type):
4143
@pytest.mark.parametrize("api_type", [AZURE, OPENAI])
4244
@configure_v0_async
4345
async def test_image_create_size(self, set_vars, azure_openai_creds, api_type):
44-
openai.api_version = "2023-10-01-preview" # not supported by later versions
46+
if api_type != OPENAI:
47+
openai.api_version = "2023-10-01-preview" # not supported by later versions
4548
image = await openai.Image.acreate(
4649
prompt="a cute baby seal",
4750
size="256x256"
@@ -66,7 +69,8 @@ async def test_image_create_response_format(self, set_vars, azure_openai_creds,
6669
@pytest.mark.parametrize("api_type", [AZURE, OPENAI])
6770
@configure_v0_async
6871
async def test_image_create_user(self, set_vars, azure_openai_creds, api_type):
69-
openai.api_version = "2023-10-01-preview" # not supported by later versions
72+
if api_type != OPENAI:
73+
openai.api_version = "2023-10-01-preview" # not supported by later versions
7074
image = await openai.Image.acreate(
7175
prompt="a cute baby seal",
7276
user="krista"

0 commit comments

Comments
 (0)