Skip to content

Commit

Permalink
adding tests and recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinaperalta committed Mar 11, 2021
1 parent 80a06b1 commit 17bab84
Show file tree
Hide file tree
Showing 50 changed files with 5,831 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,9 @@ def begin_recognize_custom_forms(self, model_id, form, **kwargs):

include_field_elements = kwargs.pop("include_field_elements", False)

polling=LROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)
polling = LROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)

# FIXME: part of this code will be removed once autorest can handle diff mixin
# signatures across API versions
Expand Down Expand Up @@ -843,9 +843,9 @@ def begin_recognize_custom_forms_from_url(self, model_id, form_url, **kwargs):
"polling_interval", self._client._config.polling_interval
)

polling=LROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)
polling = LROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)

# FIXME: part of this code will be removed once autorest can handle diff mixin
# signatures across API versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ async def begin_recognize_custom_forms(
pages = kwargs.pop("pages", None)
include_field_elements = kwargs.pop("include_field_elements", False)

polling=AsyncLROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)
polling = AsyncLROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)

# FIXME: part of this code will be removed once autorest can handle diff mixin
# signatures across API versions
Expand Down Expand Up @@ -858,9 +858,9 @@ async def begin_recognize_custom_forms_from_url(
continuation_token = kwargs.pop("continuation_token", None)
include_field_elements = kwargs.pop("include_field_elements", False)

polling=AsyncLROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)
polling = AsyncLROBasePolling(
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
)

# FIXME: part of this code will be removed once autorest can handle diff mixin
# signatures across API versions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
interactions:
- request:
body: '!!! The request body has been omitted from the recording because its size
915108 is larger than 128KB. !!!'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '915108'
Content-Type:
- image/jpeg
User-Agent:
- azsdk-python-ai-formrecognizer/3.1.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyze?includeTextDetails=false&pages=1
response:
body:
string: ''
headers:
apim-request-id:
- e800b802-37c0-46c9-9381-7f3670e3e8e4
content-length:
- '0'
date:
- Thu, 11 Mar 2021 17:47:07 GMT
operation-location:
- https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/e800b802-37c0-46c9-9381-7f3670e3e8e4
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '454'
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-ai-formrecognizer/3.1.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/e800b802-37c0-46c9-9381-7f3670e3e8e4
response:
body:
string: '{"status": "succeeded", "createdDateTime": "2021-03-11T17:47:07Z",
"lastUpdatedDateTime": "2021-03-11T17:47:11Z", "analyzeResult": {"version":
"2.1.0", "readResults": [{"page": 1, "angle": -16.6836, "width": 4032, "height":
3024, "unit": "pixel"}], "documentResults": [{"docType": "prebuilt:businesscard",
"pageRange": [1, 1], "fields": {"Addresses": {"type": "array", "valueArray":
[{"type": "string", "valueString": "2 Kingdom Street Paddington, London, W2
6BD", "text": "2 Kingdom Street Paddington, London, W2 6BD", "boundingBox":
[1227.3, 2138.3, 2520.2, 1690.5, 2597, 1912.3, 1304.1, 2360.1], "page": 1,
"confidence": 0.98}]}, "CompanyNames": {"type": "array", "valueArray": [{"type":
"string", "valueString": "Contoso", "text": "Contoso", "boundingBox": [1146,
1926, 2224, 1587, 2285, 1756, 1202, 2099], "page": 1, "confidence": 0.168}]},
"ContactNames": {"type": "array", "valueArray": [{"type": "object", "valueObject":
{"FirstName": {"type": "string", "valueString": "Avery", "text": "Avery",
"boundingBox": [666, 1102, 1111, 995, 1140, 1114, 696, 1216], "page": 1},
"LastName": {"type": "string", "valueString": "Smith", "text": "Smith", "boundingBox":
[1170, 981, 1571, 881, 1600, 1000, 1200, 1100], "page": 1}}, "text": "Dr.
Avery Smith", "boundingBox": [414.1, 1153, 1572, 880.8, 1601.3, 1005.6, 443.5,
1277.9], "page": 1, "confidence": 0.979}]}, "Departments": {"type": "array",
"valueArray": [{"type": "string", "valueString": "Cloud & Al Department",
"text": "Cloud & Al Department", "boundingBox": [473.6, 1409.5, 1586, 1134,
1607.3, 1219.8, 494.9, 1495.3], "page": 1, "confidence": 0.989}]}, "Emails":
{"type": "array", "valueArray": [{"type": "string", "valueString": "avery.smith@contoso.com",
"text": "avery.smith@contoso.com", "boundingBox": [2106, 934, 2908, 706, 2921,
769, 2122, 993], "page": 1, "confidence": 0.99}]}, "Faxes": {"type": "array",
"valueArray": [{"type": "phoneNumber", "text": "+44 (0) 20 6789 2345", "boundingBox":
[2520.4, 1195.5, 3191.8, 983.5, 3215.8, 1059.2, 2544.3, 1271.3], "page": 1,
"confidence": 0.99}]}, "JobTitles": {"type": "array", "valueArray": [{"type":
"string", "valueString": "Senior Researcher", "text": "Senior Researcher",
"boundingBox": [451, 1312, 1315.9, 1103.6, 1334.7, 1181.7, 469.8, 1390], "page":
1, "confidence": 0.99}]}, "MobilePhones": {"type": "array", "valueArray":
[{"type": "phoneNumber", "text": "+44 (0) 7911 123456", "boundingBox": [2426.8,
1040.1, 3065.5, 846, 3087.2, 917.6, 2448.5, 1111.7], "page": 1, "confidence":
0.99}]}, "Websites": {"type": "array", "valueArray": [{"type": "string", "valueString":
"https://www.contoso.com/", "text": "https://www.contoso.com/", "boundingBox":
[2120, 1003, 2981, 757, 3006, 824, 2139, 1075], "page": 1, "confidence": 0.99}]},
"WorkPhones": {"type": "array", "valueArray": [{"type": "phoneNumber", "text":
"+44 (0) 20 9876 5432", "boundingBox": [2468.2, 1118.1, 3130.3, 914.6, 3152.9,
988.2, 2490.8, 1191.6], "page": 1, "confidence": 0.989}]}}}]}}'
headers:
apim-request-id:
- 1b20e12c-ddd7-4ca4-80bc-35b899311ddd
content-length:
- '2684'
content-type:
- application/json; charset=utf-8
date:
- Thu, 11 Mar 2021 17:47:12 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '18'
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
interactions:
- request:
body: '!!! The request body has been omitted from the recording because its size
915108 is larger than 128KB. !!!'
headers:
Accept:
- application/json
Content-Type:
- image/jpeg
User-Agent:
- azsdk-python-ai-formrecognizer/3.1.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyze?includeTextDetails=false&pages=1
response:
body:
string: ''
headers:
apim-request-id: 7db70dd9-42a8-4d0b-bfbf-259d1479f219
content-length: '0'
date: Thu, 11 Mar 2021 17:44:13 GMT
operation-location: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/7db70dd9-42a8-4d0b-bfbf-259d1479f219
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
x-envoy-upstream-service-time: '575'
status:
code: 202
message: Accepted
url: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyze?includeTextDetails=false&pages=1
- request:
body: null
headers:
User-Agent:
- azsdk-python-ai-formrecognizer/3.1.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/7db70dd9-42a8-4d0b-bfbf-259d1479f219
response:
body:
string: '{"status": "succeeded", "createdDateTime": "2021-03-11T17:44:13Z",
"lastUpdatedDateTime": "2021-03-11T17:44:15Z", "analyzeResult": {"version":
"2.1.0", "readResults": [{"page": 1, "angle": -16.6836, "width": 4032, "height":
3024, "unit": "pixel"}], "documentResults": [{"docType": "prebuilt:businesscard",
"pageRange": [1, 1], "fields": {"Addresses": {"type": "array", "valueArray":
[{"type": "string", "valueString": "2 Kingdom Street Paddington, London, W2
6BD", "text": "2 Kingdom Street Paddington, London, W2 6BD", "boundingBox":
[1227.3, 2138.3, 2520.2, 1690.5, 2597, 1912.3, 1304.1, 2360.1], "page": 1,
"confidence": 0.98}]}, "CompanyNames": {"type": "array", "valueArray": [{"type":
"string", "valueString": "Contoso", "text": "Contoso", "boundingBox": [1146,
1926, 2224, 1587, 2285, 1756, 1202, 2099], "page": 1, "confidence": 0.168}]},
"ContactNames": {"type": "array", "valueArray": [{"type": "object", "valueObject":
{"FirstName": {"type": "string", "valueString": "Avery", "text": "Avery",
"boundingBox": [666, 1102, 1111, 995, 1140, 1114, 696, 1216], "page": 1},
"LastName": {"type": "string", "valueString": "Smith", "text": "Smith", "boundingBox":
[1170, 981, 1571, 881, 1600, 1000, 1200, 1100], "page": 1}}, "text": "Dr.
Avery Smith", "boundingBox": [414.1, 1153, 1572, 880.8, 1601.3, 1005.6, 443.5,
1277.9], "page": 1, "confidence": 0.979}]}, "Departments": {"type": "array",
"valueArray": [{"type": "string", "valueString": "Cloud & Al Department",
"text": "Cloud & Al Department", "boundingBox": [473.6, 1409.5, 1586, 1134,
1607.3, 1219.8, 494.9, 1495.3], "page": 1, "confidence": 0.989}]}, "Emails":
{"type": "array", "valueArray": [{"type": "string", "valueString": "avery.smith@contoso.com",
"text": "avery.smith@contoso.com", "boundingBox": [2106, 934, 2908, 706, 2921,
769, 2122, 993], "page": 1, "confidence": 0.99}]}, "Faxes": {"type": "array",
"valueArray": [{"type": "phoneNumber", "text": "+44 (0) 20 6789 2345", "boundingBox":
[2520.4, 1195.5, 3191.8, 983.5, 3215.8, 1059.2, 2544.3, 1271.3], "page": 1,
"confidence": 0.99}]}, "JobTitles": {"type": "array", "valueArray": [{"type":
"string", "valueString": "Senior Researcher", "text": "Senior Researcher",
"boundingBox": [451, 1312, 1315.9, 1103.6, 1334.7, 1181.7, 469.8, 1390], "page":
1, "confidence": 0.99}]}, "MobilePhones": {"type": "array", "valueArray":
[{"type": "phoneNumber", "text": "+44 (0) 7911 123456", "boundingBox": [2426.8,
1040.1, 3065.5, 846, 3087.2, 917.6, 2448.5, 1111.7], "page": 1, "confidence":
0.99}]}, "Websites": {"type": "array", "valueArray": [{"type": "string", "valueString":
"https://www.contoso.com/", "text": "https://www.contoso.com/", "boundingBox":
[2120, 1003, 2981, 757, 3006, 824, 2139, 1075], "page": 1, "confidence": 0.99}]},
"WorkPhones": {"type": "array", "valueArray": [{"type": "phoneNumber", "text":
"+44 (0) 20 9876 5432", "boundingBox": [2468.2, 1118.1, 3130.3, 914.6, 3152.9,
988.2, 2490.8, 1191.6], "page": 1, "confidence": 0.989}]}}}]}}'
headers:
apim-request-id: 6ca0080a-fc15-4cde-af36-878fb149a563
content-length: '2684'
content-type: application/json; charset=utf-8
date: Thu, 11 Mar 2021 17:44:18 GMT
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
x-envoy-upstream-service-time: '19'
status:
code: 200
message: OK
url: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/7db70dd9-42a8-4d0b-bfbf-259d1479f219
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
interactions:
- request:
body: 'b''{"source": "blob_sas_url"}'''
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '229'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-formrecognizer/3.1.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: POST
uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyze?includeTextDetails=false&pages=1
response:
body:
string: ''
headers:
apim-request-id:
- b700df9f-5fdc-4269-b408-e165ae09080a
content-length:
- '0'
date:
- Thu, 11 Mar 2021 17:46:21 GMT
operation-location:
- https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/b700df9f-5fdc-4269-b408-e165ae09080a
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '982'
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-ai-formrecognizer/3.1.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://region.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.3/prebuilt/businessCard/analyzeResults/b700df9f-5fdc-4269-b408-e165ae09080a
response:
body:
string: '{"status": "succeeded", "createdDateTime": "2021-03-11T17:46:21Z",
"lastUpdatedDateTime": "2021-03-11T17:46:24Z", "analyzeResult": {"version":
"2.1.0", "readResults": [{"page": 1, "angle": -16.6836, "width": 4032, "height":
3024, "unit": "pixel"}], "documentResults": [{"docType": "prebuilt:businesscard",
"pageRange": [1, 1], "fields": {"Addresses": {"type": "array", "valueArray":
[{"type": "string", "valueString": "2 Kingdom Street Paddington, London, W2
6BD", "text": "2 Kingdom Street Paddington, London, W2 6BD", "boundingBox":
[1227.3, 2138.3, 2520.2, 1690.5, 2597, 1912.3, 1304.1, 2360.1], "page": 1,
"confidence": 0.98}]}, "CompanyNames": {"type": "array", "valueArray": [{"type":
"string", "valueString": "Contoso", "text": "Contoso", "boundingBox": [1146,
1926, 2224, 1587, 2285, 1756, 1202, 2099], "page": 1, "confidence": 0.168}]},
"ContactNames": {"type": "array", "valueArray": [{"type": "object", "valueObject":
{"FirstName": {"type": "string", "valueString": "Avery", "text": "Avery",
"boundingBox": [666, 1102, 1111, 995, 1140, 1114, 696, 1216], "page": 1},
"LastName": {"type": "string", "valueString": "Smith", "text": "Smith", "boundingBox":
[1170, 981, 1571, 881, 1600, 1000, 1200, 1100], "page": 1}}, "text": "Dr.
Avery Smith", "boundingBox": [414.1, 1153, 1572, 880.8, 1601.3, 1005.6, 443.5,
1277.9], "page": 1, "confidence": 0.979}]}, "Departments": {"type": "array",
"valueArray": [{"type": "string", "valueString": "Cloud & Al Department",
"text": "Cloud & Al Department", "boundingBox": [473.6, 1409.5, 1586, 1134,
1607.3, 1219.8, 494.9, 1495.3], "page": 1, "confidence": 0.989}]}, "Emails":
{"type": "array", "valueArray": [{"type": "string", "valueString": "avery.smith@contoso.com",
"text": "avery.smith@contoso.com", "boundingBox": [2106, 934, 2908, 706, 2921,
769, 2122, 993], "page": 1, "confidence": 0.99}]}, "Faxes": {"type": "array",
"valueArray": [{"type": "phoneNumber", "text": "+44 (0) 20 6789 2345", "boundingBox":
[2520.4, 1195.5, 3191.8, 983.5, 3215.8, 1059.2, 2544.3, 1271.3], "page": 1,
"confidence": 0.99}]}, "JobTitles": {"type": "array", "valueArray": [{"type":
"string", "valueString": "Senior Researcher", "text": "Senior Researcher",
"boundingBox": [451, 1312, 1315.9, 1103.6, 1334.7, 1181.7, 469.8, 1390], "page":
1, "confidence": 0.99}]}, "MobilePhones": {"type": "array", "valueArray":
[{"type": "phoneNumber", "text": "+44 (0) 7911 123456", "boundingBox": [2426.8,
1040.1, 3065.5, 846, 3087.2, 917.6, 2448.5, 1111.7], "page": 1, "confidence":
0.99}]}, "Websites": {"type": "array", "valueArray": [{"type": "string", "valueString":
"https://www.contoso.com/", "text": "https://www.contoso.com/", "boundingBox":
[2120, 1003, 2981, 757, 3006, 824, 2139, 1075], "page": 1, "confidence": 0.99}]},
"WorkPhones": {"type": "array", "valueArray": [{"type": "phoneNumber", "text":
"+44 (0) 20 9876 5432", "boundingBox": [2468.2, 1118.1, 3130.3, 914.6, 3152.9,
988.2, 2490.8, 1191.6], "page": 1, "confidence": 0.989}]}}}]}}'
headers:
apim-request-id:
- 2ba20771-b431-4590-a7eb-d55484d753a7
content-length:
- '2684'
content-type:
- application/json; charset=utf-8
date:
- Thu, 11 Mar 2021 17:46:26 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '19'
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 17bab84

Please sign in to comment.