-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[form recognizer] add receipt locale tests (#14327)
- Loading branch information
1 parent
0d70c4b
commit de390a6
Showing
14 changed files
with
11,738 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,753 changes: 2,753 additions & 0 deletions
2,753
...izer/azure-ai-formrecognizer/tests/recordings/test_receipt.test_receipt_locale_error.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
3,033 changes: 3,033 additions & 0 deletions
3,033
.../azure-ai-formrecognizer/tests/recordings/test_receipt.test_receipt_locale_specified.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
2,741 changes: 2,741 additions & 0 deletions
2,741
...zure-ai-formrecognizer/tests/recordings/test_receipt_async.test_receipt_locale_error.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
2,799 changes: 2,799 additions & 0 deletions
2,799
...-ai-formrecognizer/tests/recordings/test_receipt_async.test_receipt_locale_specified.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...e-ai-formrecognizer/tests/recordings/test_receipt_from_url.test_receipt_locale_error.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
interactions: | ||
- request: | ||
body: 'b''{"source": "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/master/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-allinone.jpg"}''' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '172' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale | ||
response: | ||
body: | ||
string: '{"error": {"code": "UnsupportedLocale", "innerError": {"requestId": | ||
"1bddf385-9578-4b65-8a4c-8b1d0056f4a2"}, "message": "Locale unsupported. Supported | ||
locales include en-AU, en-CA, en-GB, en-IN and en-US."}}' | ||
headers: | ||
apim-request-id: | ||
- 1bddf385-9578-4b65-8a4c-8b1d0056f4a2 | ||
content-length: | ||
- '200' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 07 Oct 2020 17:00:08 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '472' | ||
status: | ||
code: 400 | ||
message: Bad Request | ||
version: 1 |
112 changes: 112 additions & 0 deletions
112
...-formrecognizer/tests/recordings/test_receipt_from_url.test_receipt_locale_specified.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
interactions: | ||
- request: | ||
body: 'b''{"source": "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/master/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-allinone.jpg"}''' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '172' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=en-IN | ||
response: | ||
body: | ||
string: '' | ||
headers: | ||
apim-request-id: | ||
- c488f61a-c341-4156-a22e-088945bfb87d | ||
content-length: | ||
- '0' | ||
date: | ||
- Wed, 07 Oct 2020 18:21:20 GMT | ||
operation-location: | ||
- https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyzeResults/c488f61a-c341-4156-a22e-088945bfb87d | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '458' | ||
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.0b1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: GET | ||
uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyzeResults/c488f61a-c341-4156-a22e-088945bfb87d | ||
response: | ||
body: | ||
string: '{"status": "succeeded", "createdDateTime": "2020-10-07T18:21:21Z", | ||
"lastUpdatedDateTime": "2020-10-07T18:21:24Z", "analyzeResult": {"version": | ||
"2.1.0", "readResults": [{"page": 1, "angle": 0.1273, "width": 1688, "height": | ||
3000, "unit": "pixel"}], "documentResults": [{"docType": "prebuilt:receipt", | ||
"pageRange": [1, 1], "fields": {"ReceiptType": {"type": "string", "valueString": | ||
"Itemized", "confidence": 0.99}, "MerchantName": {"type": "string", "valueString": | ||
"Contoso Contoso", "text": "Contoso Contoso", "boundingBox": [380.9, 282.9, | ||
1116, 473.2, 1025, 824.4, 290, 634], "page": 1, "confidence": 0.769}, "MerchantAddress": | ||
{"type": "string", "valueString": "123 Main Street Redmond, WA 98052", "text": | ||
"123 Main Street Redmond, WA 98052", "boundingBox": [298.3, 676.5, 844.6, | ||
781.5, 810.7, 958, 264.4, 853], "page": 1, "confidence": 0.99}, "MerchantPhoneNumber": | ||
{"type": "phoneNumber", "valuePhoneNumber": "+919876543210", "text": "987-654-3210", | ||
"boundingBox": [271, 1000, 651, 1049, 643, 1125, 264, 1075], "page": 1, "confidence": | ||
0.995}, "TransactionDate": {"type": "date", "valueDate": "2019-10-06", "text": | ||
"6/10/2019", "boundingBox": [259, 1224, 510, 1246, 505, 1331, 255, 1312], | ||
"page": 1, "confidence": 0.995}, "TransactionTime": {"type": "time", "valueTime": | ||
"13:59:00", "text": "13:59", "boundingBox": [527, 1248, 681, 1262, 675, 1341, | ||
522, 1332], "page": 1, "confidence": 0.995}, "Items": {"type": "array", "valueArray": | ||
[{"type": "object", "valueObject": {"Quantity": {"type": "number", "valueNumber": | ||
1, "text": "1", "boundingBox": [244, 1581, 288, 1584, 285, 1678, 241, 1675], | ||
"page": 1, "confidence": 0.936}, "Name": {"type": "string", "valueString": | ||
"Cappuccino", "text": "Cappuccino", "boundingBox": [306, 1585, 658, 1598, | ||
657, 1688, 304, 1679], "page": 1, "confidence": 0.976}, "TotalPrice": {"type": | ||
"number", "valueNumber": 2.2, "text": "$2.20", "boundingBox": [1106, 1579, | ||
1260, 1574, 1263, 1656, 1108, 1662], "page": 1, "confidence": 0.988}}}, {"type": | ||
"object", "valueObject": {"Quantity": {"type": "number", "valueNumber": 1, | ||
"text": "1", "boundingBox": [227, 1839, 278, 1839, 277, 1924, 226, 1924], | ||
"page": 1, "confidence": 0.882}, "Name": {"type": "string", "valueString": | ||
"BACON & EGGS Sunny-side-up", "text": "BACON & EGGS Sunny-side-up", "boundingBox": | ||
[294, 1839, 757, 1839, 757, 2064, 294, 2064], "page": 1, "confidence": 0.506}, | ||
"TotalPrice": {"type": "number", "valueNumber": 9.5, "text": "$9.5", "boundingBox": | ||
[1134, 1948, 1252, 1948, 1252, 2041, 1134, 2041], "page": 1, "confidence": | ||
0.987}}}]}, "Tax": {"type": "number", "valueNumber": 1.17, "text": "1.17", | ||
"boundingBox": [1186, 2356, 1307, 2361, 1303, 2452, 1182, 2447], "page": 1, | ||
"confidence": 0.994}, "Total": {"type": "number", "valueNumber": 14.5, "text": | ||
"$14.50", "boundingBox": [1033, 2623, 1376, 2641, 1370, 2758, 1027, 2740], | ||
"page": 1, "confidence": 0.988}, "Subtotal": {"type": "number", "valueNumber": | ||
11.7, "text": "11.70", "boundingBox": [1139, 2228, 1309, 2228, 1308, 2313, | ||
1138, 2313], "page": 1, "confidence": 0.269}}}]}}' | ||
headers: | ||
apim-request-id: | ||
- 67697a5f-f252-4214-a878-d7c0631a8894 | ||
content-length: | ||
- '2711' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 07 Oct 2020 18:21: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 |
32 changes: 32 additions & 0 deletions
32
...ormrecognizer/tests/recordings/test_receipt_from_url_async.test_receipt_locale_error.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
interactions: | ||
- request: | ||
body: 'b''{"source": "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/master/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-allinone.jpg"}''' | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Length: | ||
- '172' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale | ||
response: | ||
body: | ||
string: '{"error": {"code": "UnsupportedLocale", "innerError": {"requestId": | ||
"cffca367-a746-4559-b678-e292a9932ea3"}, "message": "Locale unsupported. Supported | ||
locales include en-AU, en-CA, en-GB, en-IN and en-US."}}' | ||
headers: | ||
apim-request-id: cffca367-a746-4559-b678-e292a9932ea3 | ||
content-length: '200' | ||
content-type: application/json; charset=utf-8 | ||
date: Wed, 07 Oct 2020 17:00:08 GMT | ||
strict-transport-security: max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: nosniff | ||
x-envoy-upstream-service-time: '331' | ||
status: | ||
code: 400 | ||
message: Bad Request | ||
url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=not%20a%20locale | ||
version: 1 |
90 changes: 90 additions & 0 deletions
90
...ecognizer/tests/recordings/test_receipt_from_url_async.test_receipt_locale_specified.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
interactions: | ||
- request: | ||
body: 'b''{"source": "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/master/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-allinone.jpg"}''' | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Length: | ||
- '172' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=en-IN | ||
response: | ||
body: | ||
string: '' | ||
headers: | ||
apim-request-id: 306c9122-82a7-4aba-aa06-3b72db71c6e3 | ||
content-length: '0' | ||
date: Wed, 07 Oct 2020 18:21:26 GMT | ||
operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyzeResults/306c9122-82a7-4aba-aa06-3b72db71c6e3 | ||
strict-transport-security: max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: nosniff | ||
x-envoy-upstream-service-time: '296' | ||
status: | ||
code: 202 | ||
message: Accepted | ||
url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/prebuilt/receipt/analyze?includeTextDetails=false&locale=en-IN | ||
- request: | ||
body: null | ||
headers: | ||
User-Agent: | ||
- azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: GET | ||
uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyzeResults/306c9122-82a7-4aba-aa06-3b72db71c6e3 | ||
response: | ||
body: | ||
string: '{"status": "succeeded", "createdDateTime": "2020-10-07T18:21:27Z", | ||
"lastUpdatedDateTime": "2020-10-07T18:21:34Z", "analyzeResult": {"version": | ||
"2.1.0", "readResults": [{"page": 1, "angle": 0.1273, "width": 1688, "height": | ||
3000, "unit": "pixel"}], "documentResults": [{"docType": "prebuilt:receipt", | ||
"pageRange": [1, 1], "fields": {"ReceiptType": {"type": "string", "valueString": | ||
"Itemized", "confidence": 0.99}, "MerchantName": {"type": "string", "valueString": | ||
"Contoso Contoso", "text": "Contoso Contoso", "boundingBox": [380.9, 282.9, | ||
1116, 473.2, 1025, 824.4, 290, 634], "page": 1, "confidence": 0.769}, "MerchantAddress": | ||
{"type": "string", "valueString": "123 Main Street Redmond, WA 98052", "text": | ||
"123 Main Street Redmond, WA 98052", "boundingBox": [298.3, 676.5, 844.6, | ||
781.5, 810.7, 958, 264.4, 853], "page": 1, "confidence": 0.99}, "MerchantPhoneNumber": | ||
{"type": "phoneNumber", "valuePhoneNumber": "+919876543210", "text": "987-654-3210", | ||
"boundingBox": [271, 1000, 651, 1049, 643, 1125, 264, 1075], "page": 1, "confidence": | ||
0.995}, "TransactionDate": {"type": "date", "valueDate": "2019-10-06", "text": | ||
"6/10/2019", "boundingBox": [259, 1224, 510, 1246, 505, 1331, 255, 1312], | ||
"page": 1, "confidence": 0.995}, "TransactionTime": {"type": "time", "valueTime": | ||
"13:59:00", "text": "13:59", "boundingBox": [527, 1248, 681, 1262, 675, 1341, | ||
522, 1332], "page": 1, "confidence": 0.995}, "Items": {"type": "array", "valueArray": | ||
[{"type": "object", "valueObject": {"Quantity": {"type": "number", "valueNumber": | ||
1, "text": "1", "boundingBox": [244, 1581, 288, 1584, 285, 1678, 241, 1675], | ||
"page": 1, "confidence": 0.936}, "Name": {"type": "string", "valueString": | ||
"Cappuccino", "text": "Cappuccino", "boundingBox": [306, 1585, 658, 1598, | ||
657, 1688, 304, 1679], "page": 1, "confidence": 0.976}, "TotalPrice": {"type": | ||
"number", "valueNumber": 2.2, "text": "$2.20", "boundingBox": [1106, 1579, | ||
1260, 1574, 1263, 1656, 1108, 1662], "page": 1, "confidence": 0.988}}}, {"type": | ||
"object", "valueObject": {"Quantity": {"type": "number", "valueNumber": 1, | ||
"text": "1", "boundingBox": [227, 1839, 278, 1839, 277, 1924, 226, 1924], | ||
"page": 1, "confidence": 0.882}, "Name": {"type": "string", "valueString": | ||
"BACON & EGGS Sunny-side-up", "text": "BACON & EGGS Sunny-side-up", "boundingBox": | ||
[294, 1839, 757, 1839, 757, 2064, 294, 2064], "page": 1, "confidence": 0.506}, | ||
"TotalPrice": {"type": "number", "valueNumber": 9.5, "text": "$9.5", "boundingBox": | ||
[1134, 1948, 1252, 1948, 1252, 2041, 1134, 2041], "page": 1, "confidence": | ||
0.987}}}]}, "Tax": {"type": "number", "valueNumber": 1.17, "text": "1.17", | ||
"boundingBox": [1186, 2356, 1307, 2361, 1303, 2452, 1182, 2447], "page": 1, | ||
"confidence": 0.994}, "Total": {"type": "number", "valueNumber": 14.5, "text": | ||
"$14.50", "boundingBox": [1033, 2623, 1376, 2641, 1370, 2758, 1027, 2740], | ||
"page": 1, "confidence": 0.988}, "Subtotal": {"type": "number", "valueNumber": | ||
11.7, "text": "11.70", "boundingBox": [1139, 2228, 1309, 2228, 1308, 2313, | ||
1138, 2313], "page": 1, "confidence": 0.269}}}]}}' | ||
headers: | ||
apim-request-id: 3adda0b7-a2af-41d8-ad97-7e81ed615f62 | ||
content-length: '2711' | ||
content-type: application/json; charset=utf-8 | ||
date: Wed, 07 Oct 2020 18:21:31 GMT | ||
strict-transport-security: max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: nosniff | ||
x-envoy-upstream-service-time: '15' | ||
status: | ||
code: 200 | ||
message: OK | ||
url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/prebuilt/receipt/analyzeResults/306c9122-82a7-4aba-aa06-3b72db71c6e3 | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.