Skip to content

Commit 3f312b5

Browse files
committed
Reduce output during tests
runtests should not print unnecessary text to command window and test log
1 parent 70baea5 commit 3f312b5

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Diff for: tests/hopenAIChat.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function invalidInputsConstructor(testCase, InvalidConstructorInput)
8282
end
8383

8484
function generateWithStreamFunAndMaxNumTokens(testCase)
85-
sf = @(x) fprintf("%s",x);
85+
sf = @(x) x;
8686
chat = testCase.constructor(StreamFun=sf);
8787
result = generate(chat,"Why is a raven like a writing desk?",MaxNumTokens=5);
8888
testCase.verifyClass(result,"string");

Diff for: tests/texampleTests.m

+13-13
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ function closeCapture(~)
6262
methods(Test)
6363
function testAnalyzeScientificPapersUsingFunctionCalls(testCase)
6464
testCase.startCapture("AnalyzeScientificPapersUsingFunctionCalls");
65-
AnalyzeScientificPapersUsingFunctionCalls;
65+
evalc("AnalyzeScientificPapersUsingFunctionCalls");
6666
end
6767

6868
function testAnalyzeSentimentinTextUsingChatGPTwithStructuredOutput(testCase)
6969
testCase.startCapture("AnalyzeSentimentinTextUsingChatGPTwithStructuredOutput");
70-
AnalyzeSentimentinTextUsingChatGPTwithStructuredOutput;
70+
evalc("AnalyzeSentimentinTextUsingChatGPTwithStructuredOutput");
7171
end
7272

7373
function testAnalyzeTextDataUsingParallelFunctionCallwithChatGPT(testCase)
7474
testCase.startCapture("AnalyzeTextDataUsingParallelFunctionCallwithChatGPT");
75-
AnalyzeTextDataUsingParallelFunctionCallwithChatGPT;
75+
evalc("AnalyzeTextDataUsingParallelFunctionCallwithChatGPT");
7676
end
7777

7878
function testCreateSimpleChatBot(testCase,ChatBotExample)
@@ -111,55 +111,55 @@ function testCreateSimpleChatBot(testCase,ChatBotExample)
111111
numWordsResponse = []; %#ok<NASGU>
112112

113113
% Run the example
114-
eval(ChatBotExample);
114+
evalc(ChatBotExample);
115115

116116
testCase.verifyEqual(count,find(prompts=="end",1));
117117
testCase.verifySize(messages.Messages,[1 2*(count-1)]);
118118
end
119119

120120
function testDescribeImagesUsingChatGPT(testCase)
121121
testCase.startCapture("DescribeImagesUsingChatGPT");
122-
DescribeImagesUsingChatGPT;
122+
evalc("DescribeImagesUsingChatGPT");
123123
end
124124

125125
function testInformationRetrievalUsingOpenAIDocumentEmbedding(testCase)
126126
testCase.startCapture("InformationRetrievalUsingOpenAIDocumentEmbedding");
127-
InformationRetrievalUsingOpenAIDocumentEmbedding;
127+
evalc("InformationRetrievalUsingOpenAIDocumentEmbedding");
128128
end
129129

130130
function testProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode(testCase)
131131
testCase.startCapture("ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode");
132-
ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode;
132+
evalc("ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode");
133133
end
134134

135135
function testProcessGeneratedTextInRealTimeByUsingOllamaInStreamingMode(testCase)
136136
testCase.startCapture("ProcessGeneratedTextInRealTimeByUsingOllamaInStreamingMode");
137-
ProcessGeneratedTextInRealTimeByUsingOllamaInStreamingMode;
137+
evalc("ProcessGeneratedTextInRealTimeByUsingOllamaInStreamingMode");
138138
end
139139

140140
function testRetrievalAugmentedGenerationUsingChatGPTandMATLAB(testCase)
141141
testCase.startCapture("RetrievalAugmentedGenerationUsingChatGPTandMATLAB");
142-
RetrievalAugmentedGenerationUsingChatGPTandMATLAB;
142+
evalc("RetrievalAugmentedGenerationUsingChatGPTandMATLAB");
143143
end
144144

145145
function testRetrievalAugmentedGenerationUsingOllamaAndMATLAB(testCase)
146146
testCase.startCapture("RetrievalAugmentedGenerationUsingOllamaAndMATLAB");
147-
RetrievalAugmentedGenerationUsingOllamaAndMATLAB;
147+
evalc("RetrievalAugmentedGenerationUsingOllamaAndMATLAB");
148148
end
149149

150150
function testSummarizeLargeDocumentsUsingChatGPTandMATLAB(testCase)
151151
testCase.startCapture("SummarizeLargeDocumentsUsingChatGPTandMATLAB");
152-
SummarizeLargeDocumentsUsingChatGPTandMATLAB;
152+
evalc("SummarizeLargeDocumentsUsingChatGPTandMATLAB");
153153
end
154154

155155
function testUsingDALLEToEditImages(testCase)
156156
testCase.startCapture("UsingDALLEToEditImages");
157-
UsingDALLEToEditImages;
157+
evalc("UsingDALLEToEditImages");
158158
end
159159

160160
function testUsingDALLEToGenerateImages(testCase)
161161
testCase.startCapture("UsingDALLEToGenerateImages");
162-
UsingDALLEToGenerateImages;
162+
evalc("UsingDALLEToGenerateImages");
163163
end
164164
end
165165
end

0 commit comments

Comments
 (0)