Skip to content

Commit 35d5436

Browse files
[textanalytics] update health live tests due to service change (Azure#21853)
* update health live tests due to service change * remove comment but keep test as a regression check
1 parent ba8aed4 commit 35d5436

File tree

4 files changed

+45
-49
lines changed

4 files changed

+45
-49
lines changed

sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare.test_document_errors.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ interactions:
1616
Content-Type:
1717
- application/json
1818
User-Agent:
19-
- azsdk-python-ai-textanalytics/5.2.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0)
19+
- azsdk-python-ai-textanalytics/5.2.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0)
2020
method: POST
2121
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.2/entities/health/jobs?stringIndexType=UnicodeCodePoint
2222
response:
2323
body:
2424
string: ''
2525
headers:
2626
apim-request-id:
27-
- babbcb9d-429e-40ca-9069-8b403b2a7274
27+
- 19f8d0af-a534-47b0-b037-07a9b06b0b03
2828
date:
29-
- Wed, 06 Oct 2021 21:00:24 GMT
29+
- Tue, 23 Nov 2021 01:09:00 GMT
3030
operation-location:
31-
- https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.1/entities/health/jobs/a26b209e-1f7e-4a27-842a-733780d5f63e
31+
- https://westus2.api.cognitive.microsoft.com//text/analytics/v3.2-preview.2/entities/health/jobs/265d2fec-bbbd-4705-ac19-2d406eac189d
3232
strict-transport-security:
3333
- max-age=31536000; includeSubDomains; preload
3434
transfer-encoding:
3535
- chunked
3636
x-content-type-options:
3737
- nosniff
3838
x-envoy-upstream-service-time:
39-
- '266'
39+
- '335'
4040
status:
4141
code: 202
4242
message: Accepted
@@ -50,35 +50,33 @@ interactions:
5050
Connection:
5151
- keep-alive
5252
User-Agent:
53-
- azsdk-python-ai-textanalytics/5.2.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0)
53+
- azsdk-python-ai-textanalytics/5.2.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0)
5454
method: GET
55-
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.1/entities/health/jobs/a26b209e-1f7e-4a27-842a-733780d5f63e
55+
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.2/entities/health/jobs/265d2fec-bbbd-4705-ac19-2d406eac189d
5656
response:
5757
body:
58-
string: '{"jobId":"a26b209e-1f7e-4a27-842a-733780d5f63e","lastUpdateDateTime":"2021-10-06T21:00:25Z","createdDateTime":"2021-10-06T21:00:25Z","expirationDateTime":"2021-10-07T21:00:25Z","status":"succeeded","errors":[],"results":{"documents":[],"errors":[{"id":"1","error":{"code":"InvalidArgument","message":"Invalid
58+
string: '{"jobId":"265d2fec-bbbd-4705-ac19-2d406eac189d","lastUpdateDateTime":"2021-11-23T01:09:03Z","createdDateTime":"2021-11-23T01:09:00Z","expirationDateTime":"2021-11-24T01:09:00Z","status":"succeeded","errors":[],"results":{"documents":[{"id":"3","entities":[],"relations":[],"warnings":[{"code":"DocumentTruncated","message":"Document
59+
is large and must be split to be processed; relations across splits may not
60+
be caught by the model"}]}],"errors":[{"id":"1","error":{"code":"InvalidArgument","message":"Invalid
5961
document in request.","innererror":{"code":"InvalidDocument","message":"Document
6062
text is empty."}}},{"id":"2","error":{"code":"InvalidArgument","message":"Invalid
6163
Language Code.","innererror":{"code":"UnsupportedLanguageCode","message":"Invalid
62-
language code. Supported languages: en. For additional details see https://aka.ms/text-analytics/language-support"}}},{"id":"3","error":{"code":"InvalidArgument","message":"Invalid
63-
document in request.","innererror":{"code":"InvalidDocument","message":"A
64-
document within the request was too large to be processed. Limit document
65-
size to: 5120 text elements. For additional details on the data limitations
66-
see https://aka.ms/text-analytics-data-limits"}}}],"modelVersion":"2021-05-15"}}'
64+
language code. Supported languages: en. For additional details see https://aka.ms/text-analytics/language-support"}}}],"modelVersion":"2021-05-15"}}'
6765
headers:
6866
apim-request-id:
69-
- d4c1b433-82d4-471c-9d02-58189b8be7ed
67+
- de343c73-d70c-4cee-b4dc-bf5bcb783453
7068
content-type:
7169
- application/json; charset=utf-8
7270
date:
73-
- Wed, 06 Oct 2021 21:00:29 GMT
71+
- Tue, 23 Nov 2021 01:09:05 GMT
7472
strict-transport-security:
7573
- max-age=31536000; includeSubDomains; preload
7674
transfer-encoding:
7775
- chunked
7876
x-content-type-options:
7977
- nosniff
8078
x-envoy-upstream-service-time:
81-
- '75'
79+
- '332'
8280
status:
8381
code: 200
8482
message: OK

sdk/textanalytics/azure-ai-textanalytics/tests/recordings/test_analyze_healthcare_async.test_document_errors.yaml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,50 @@ interactions:
1212
Content-Type:
1313
- application/json
1414
User-Agent:
15-
- azsdk-python-ai-textanalytics/5.2.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0)
15+
- azsdk-python-ai-textanalytics/5.2.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0)
1616
method: POST
1717
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.2/entities/health/jobs?stringIndexType=UnicodeCodePoint
1818
response:
1919
body:
2020
string: ''
2121
headers:
22-
apim-request-id: 5aa9d41c-1e0a-440f-abad-62818fc1a2e8
23-
date: Wed, 06 Oct 2021 21:02:10 GMT
24-
operation-location: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.1/entities/health/jobs/fc017c6f-ec2c-4d68-be54-fd3b34dfceaf
22+
apim-request-id: 9b7a98e2-ce3a-4e2b-8f28-35b8a4960e8e
23+
date: Tue, 23 Nov 2021 01:11:00 GMT
24+
operation-location: https://westus2.api.cognitive.microsoft.com//text/analytics/v3.2-preview.2/entities/health/jobs/cde5ca0f-d52b-40de-bd83-ca3c304d3a29
2525
strict-transport-security: max-age=31536000; includeSubDomains; preload
2626
transfer-encoding: chunked
2727
x-content-type-options: nosniff
28-
x-envoy-upstream-service-time: '380'
28+
x-envoy-upstream-service-time: '227'
2929
status:
3030
code: 202
3131
message: Accepted
32-
url: https://javatextanalyticstestresources.cognitiveservices.azure.com//text/analytics/v3.2-preview.2/entities/health/jobs?stringIndexType=UnicodeCodePoint
32+
url: https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.2-preview.2/entities/health/jobs?stringIndexType=UnicodeCodePoint
3333
- request:
3434
body: null
3535
headers:
3636
User-Agent:
37-
- azsdk-python-ai-textanalytics/5.2.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0)
37+
- azsdk-python-ai-textanalytics/5.2.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0)
3838
method: GET
39-
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.1/entities/health/jobs/fc017c6f-ec2c-4d68-be54-fd3b34dfceaf
39+
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.2-preview.2/entities/health/jobs/cde5ca0f-d52b-40de-bd83-ca3c304d3a29
4040
response:
4141
body:
42-
string: '{"jobId":"fc017c6f-ec2c-4d68-be54-fd3b34dfceaf","lastUpdateDateTime":"2021-10-06T21:02:11Z","createdDateTime":"2021-10-06T21:02:10Z","expirationDateTime":"2021-10-07T21:02:10Z","status":"succeeded","errors":[],"results":{"documents":[],"errors":[{"id":"1","error":{"code":"InvalidArgument","message":"Invalid
42+
string: '{"jobId":"cde5ca0f-d52b-40de-bd83-ca3c304d3a29","lastUpdateDateTime":"2021-11-23T01:11:04Z","createdDateTime":"2021-11-23T01:11:00Z","expirationDateTime":"2021-11-24T01:11:00Z","status":"succeeded","errors":[],"results":{"documents":[{"id":"3","entities":[],"relations":[],"warnings":[{"code":"DocumentTruncated","message":"Document
43+
is large and must be split to be processed; relations across splits may not
44+
be caught by the model"}]}],"errors":[{"id":"1","error":{"code":"InvalidArgument","message":"Invalid
4345
document in request.","innererror":{"code":"InvalidDocument","message":"Document
4446
text is empty."}}},{"id":"2","error":{"code":"InvalidArgument","message":"Invalid
4547
Language Code.","innererror":{"code":"UnsupportedLanguageCode","message":"Invalid
46-
language code. Supported languages: en. For additional details see https://aka.ms/text-analytics/language-support"}}},{"id":"3","error":{"code":"InvalidArgument","message":"Invalid
47-
document in request.","innererror":{"code":"InvalidDocument","message":"A
48-
document within the request was too large to be processed. Limit document
49-
size to: 5120 text elements. For additional details on the data limitations
50-
see https://aka.ms/text-analytics-data-limits"}}}],"modelVersion":"2021-05-15"}}'
48+
language code. Supported languages: en. For additional details see https://aka.ms/text-analytics/language-support"}}}],"modelVersion":"2021-05-15"}}'
5149
headers:
52-
apim-request-id: 10d73066-ef26-4e95-98b9-53f1b129eac9
50+
apim-request-id: e3a11ff8-78d3-4316-a6b0-4515e8d3497c
5351
content-type: application/json; charset=utf-8
54-
date: Wed, 06 Oct 2021 21:02:15 GMT
52+
date: Tue, 23 Nov 2021 01:11:05 GMT
5553
strict-transport-security: max-age=31536000; includeSubDomains; preload
5654
transfer-encoding: chunked
5755
x-content-type-options: nosniff
58-
x-envoy-upstream-service-time: '69'
56+
x-envoy-upstream-service-time: '183'
5957
status:
6058
code: 200
6159
message: OK
62-
url: https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.2-preview.1/entities/health/jobs/fc017c6f-ec2c-4d68-be54-fd3b34dfceaf
60+
url: https://javatextanalyticstestresources.cognitiveservices.azure.com/text/analytics/v3.2-preview.2/entities/health/jobs/cde5ca0f-d52b-40de-bd83-ca3c304d3a29
6361
version: 1

sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ def test_document_errors(self, client):
244244
{"id": "3", "text": text}]
245245

246246
result = client.begin_analyze_healthcare_entities(docs, polling_interval=self._interval()).result()
247-
doc_errors = list(result)
248-
self.assertEqual(doc_errors[0].error.code, "InvalidDocument")
249-
self.assertIsNotNone(doc_errors[0].error.message)
250-
self.assertEqual(doc_errors[1].error.code, "UnsupportedLanguageCode")
251-
self.assertIsNotNone(doc_errors[1].error.message)
252-
self.assertEqual(doc_errors[2].error.code, "InvalidDocument")
253-
self.assertIsNotNone(doc_errors[2].error.message)
247+
doc_results = list(result)
248+
self.assertEqual(doc_results[0].error.code, "InvalidDocument")
249+
self.assertIsNotNone(doc_results[0].error.message)
250+
self.assertEqual(doc_results[1].error.code, "UnsupportedLanguageCode")
251+
self.assertIsNotNone(doc_results[1].error.message)
252+
assert not doc_results[2].is_error
253+
assert doc_results[2].warnings
254254

255255
@TextAnalyticsPreparer()
256256
@TextAnalyticsClientPreparer()

sdk/textanalytics/azure-ai-textanalytics/tests/test_analyze_healthcare_async.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ async def test_document_errors(self, client):
266266

267267
async with client:
268268
result = await(await client.begin_analyze_healthcare_entities(docs, polling_interval=self._interval())).result()
269-
doc_errors = []
269+
doc_results = []
270270
async for r in result:
271-
doc_errors.append(r)
272-
self.assertEqual(doc_errors[0].error.code, "InvalidDocument")
273-
self.assertIsNotNone(doc_errors[0].error.message)
274-
self.assertEqual(doc_errors[1].error.code, "UnsupportedLanguageCode")
275-
self.assertIsNotNone(doc_errors[1].error.message)
276-
self.assertEqual(doc_errors[2].error.code, "InvalidDocument")
277-
self.assertIsNotNone(doc_errors[2].error.message)
271+
doc_results.append(r)
272+
self.assertEqual(doc_results[0].error.code, "InvalidDocument")
273+
self.assertIsNotNone(doc_results[0].error.message)
274+
self.assertEqual(doc_results[1].error.code, "UnsupportedLanguageCode")
275+
self.assertIsNotNone(doc_results[1].error.message)
276+
assert not doc_results[2].is_error
277+
assert doc_results[2].warnings
278278

279279
@TextAnalyticsPreparer()
280280
@TextAnalyticsClientPreparer()

0 commit comments

Comments
 (0)