-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sync and async extrqct-json tests, add README
- Loading branch information
Showing
8 changed files
with
141 additions
and
3 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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/bin/sh | ||
python -m unittest discover tests | ||
python -m unittest discover tests -v |
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,27 @@ | ||
# Testing | ||
Overview of running tests for AnyParser sdk. These should be run before submitting any pull request. | ||
|
||
These tests are written using the unittest framework in Python. The tests are located in the `tests/test.py` file. Test data is located in the `tests/test_data.py` file. | ||
|
||
## Setup | ||
1. Install the required packages by running the following command: | ||
```bash | ||
pip install Levenshtein | ||
``` | ||
|
||
## Running Tests | ||
1. Make sure you are in the root folder. | ||
2. Run the following command: | ||
```bash | ||
./run_tests.sh | ||
``` | ||
|
||
If you just want to run an individual test within the test.py file, you can run the following command: | ||
```bash | ||
python -m unittest -k <test_name> | ||
``` | ||
|
||
For example, if you want to run `test_pdf_sync_extract`, you can run the following command: | ||
```bash | ||
python -m unittest -k test_pdf_sync_extract | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
EXTRACT_JSON_TEST_DATA = [ | ||
{ | ||
"working_file": "./examples/sample_data/test1.pdf", | ||
"extract_instruction": { | ||
"social_security_number": "the social security number of the employee", | ||
"ein": "the employer identification number", | ||
"first_name": "the first name of the employee", | ||
"last_name": "the last name of the employee", | ||
}, | ||
"correct_output": [ | ||
[ | ||
{ | ||
"social_security_number": "758-58-5787", | ||
"ein": "78-8778788", | ||
"first_name": "Jesan", | ||
"last_name": "Rahaman", | ||
} | ||
] | ||
], | ||
}, | ||
{ | ||
"working_file": "./examples/sample_data/test_w2.pptx", | ||
"extract_instruction": { | ||
"social_security_number": "the social security number of the employee", | ||
"ein": "the employer identification number", | ||
"first_name": "the first name of the employee", | ||
"last_name": "the last name of the employee", | ||
}, | ||
"correct_output": [ | ||
[ | ||
{ | ||
"social_security_number": "758-58-5787", | ||
"ein": "78-8778788", | ||
"first_name": "Jesan", | ||
"last_name": "Rahaman", | ||
} | ||
] | ||
], | ||
}, | ||
{ | ||
"working_file": "./examples/sample_data/test_w2.docx", | ||
"extract_instruction": { | ||
"social_security_number": "the social security number of the employee", | ||
"ein": "the employer identification number", | ||
"first_name": "the first name of the employee", | ||
"last_name": "the last name of the employee", | ||
}, | ||
"correct_output": [ | ||
[ | ||
{ | ||
"social_security_number": "758-58-5787", | ||
"ein": "78-8778788", | ||
"first_name": "Jesan", | ||
"last_name": "Rahaman", | ||
} | ||
] | ||
], | ||
}, | ||
{ | ||
"working_file": "./examples/sample_data/test_w2.png", | ||
"extract_instruction": { | ||
"social_security_number": "the social security number of the employee", | ||
"ein": "the employer identification number", | ||
"first_name": "the first name of the employee", | ||
"last_name": "the last name of the employee", | ||
}, | ||
"correct_output": [ | ||
[ | ||
{ | ||
"social_security_number": "758-58-5787", | ||
"ein": "78-8778788", | ||
"first_name": "Jesan", | ||
"last_name": "Rahaman", | ||
} | ||
] | ||
], | ||
}, | ||
] |