File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 10
10
end
11
11
12
12
methods (Test )
13
- % Test methods
14
- function keyNotFound(testCase )
15
- import matlab .unittest .fixtures .EnvironmentVariableFixture
16
- testCase .applyFixture(EnvironmentVariableFixture(" AZURE_OPENAI_API_KEY" ," dummy" ));
17
- unsetenv(" AZURE_OPENAI_API_KEY" );
18
- testCase .verifyError(@()azureChat(getenv(" AZURE_OPENAI_ENDPOINT" ), getenv(" AZURE_OPENAI_DEPLOYMENT" )), " llms:keyMustBeSpecified" );
19
- end
20
-
21
13
function constructChatWithAllNVP(testCase )
22
14
endpoint = getenv(" AZURE_OPENAI_ENDPOINT" );
23
15
deploymentID = " hello" ;
@@ -100,6 +92,16 @@ function assignValueToProperty(property, value)
100
92
101
93
testCase .verifyError(@()assignValueToProperty(InvalidValuesSetters .Property ,InvalidValuesSetters .Value ), InvalidValuesSetters .Error );
102
94
end
95
+
96
+ function keyNotFound(testCase )
97
+ % to verify the error, we need to unset the environment variable
98
+ % AZURE_OPENAI_API_KEY, if given. Use a fixture to restore the
99
+ % value on leaving the test point:
100
+ import matlab .unittest .fixtures .EnvironmentVariableFixture
101
+ testCase .applyFixture(EnvironmentVariableFixture(" AZURE_OPENAI_API_KEY" ," dummy" ));
102
+ unsetenv(" AZURE_OPENAI_API_KEY" );
103
+ testCase .verifyError(@()azureChat(getenv(" AZURE_OPENAI_ENDPOINT" ), getenv(" AZURE_OPENAI_DEPLOYMENT" )), " llms:keyMustBeSpecified" );
104
+ end
103
105
end
104
106
end
105
107
You can’t perform that action at this time.
0 commit comments