4
4
# pylint: disable=protected-access
5
5
# pylint: disable=too-many-lines
6
6
7
- import json
8
- import requests
7
+ import unittest
9
8
from os import path
10
9
from typing import List , Dict
11
- import unittest
12
10
from unittest .mock import patch
11
+
12
+ import json
13
+ import requests
13
14
from aiohttp import ClientSession
14
15
15
16
import aiounittest
@@ -171,9 +172,7 @@ async def test_returns_answer_using_requests_module(self):
171
172
response_path : str = "ReturnsAnswer.json"
172
173
response_json = QnaApplicationTest ._get_json_for_file (response_path )
173
174
174
- qna = QnAMaker (
175
- endpoint = QnaApplicationTest .tests_endpoint , http_client = requests
176
- )
175
+ qna = QnAMaker (endpoint = QnaApplicationTest .tests_endpoint , http_client = requests )
177
176
context = QnaApplicationTest ._get_context (question , TestAdapter ())
178
177
179
178
with patch ("requests.post" , return_value = response_json ):
@@ -185,7 +184,7 @@ async def test_returns_answer_using_requests_module(self):
185
184
self .assertEqual (
186
185
"BaseCamp: You can use a damp rag to clean around the Power Pack" ,
187
186
answers [0 ].answer ,
188
- )
187
+ )
189
188
190
189
async def test_returns_answer_using_options (self ):
191
190
# Arrange
@@ -287,7 +286,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self):
287
286
context = None ,
288
287
qna_id = None ,
289
288
is_test = False ,
290
- ranker_type = "Default"
289
+ ranker_type = "Default" ,
291
290
)
292
291
response_path = "ReturnsAnswer.json"
293
292
response_json = QnaApplicationTest ._get_json_for_file (response_path )
@@ -296,10 +295,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self):
296
295
297
296
with patch ("requests.post" , return_value = response_json ):
298
297
result = await http_request_helper .execute_http_request (
299
- url ,
300
- question ,
301
- QnaApplicationTest .tests_endpoint ,
302
- timeout = None
298
+ url , question , QnaApplicationTest .tests_endpoint , timeout = None
303
299
)
304
300
answers = result ["answers" ]
305
301
@@ -308,7 +304,7 @@ async def test_returns_answer_using_requests_module_with_no_timeout(self):
308
304
self .assertEqual (
309
305
"BaseCamp: You can use a damp rag to clean around the Power Pack" ,
310
306
answers [0 ]["answer" ],
311
- )
307
+ )
312
308
313
309
async def test_telemetry_returns_answer (self ):
314
310
# Arrange
0 commit comments