Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

65 create test to make sure validations stay in sync with 2024 validationscsv #69

Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3a62c46
Update the phase_validations.py to be consistent with the updated CSV
jcadam14 Dec 4, 2023
71e5b46
Adds the test_csv_differences.py to check for discrepancies between t…
jcadam14 Dec 4, 2023
8fb6ef8
Fixing Black formatting issues
jcadam14 Dec 4, 2023
4fe809c
Ruff and Black formatting
jcadam14 Dec 5, 2023
4fcc327
Ruff linting
jcadam14 Dec 5, 2023
30b9439
Ruff and Black linting seem to be at odds. So trying to resolve that
jcadam14 Dec 5, 2023
6d3787d
Merge branch '68_correct_validation_description_errors' into 65-creat…
jcadam14 Dec 5, 2023
5c15826
Remove all formatting from the python code and csv descriptions for E…
jcadam14 Dec 5, 2023
6e788e9
Updated the descriptions for E2014 and E2015 to be similar to the CSV
jcadam14 Dec 5, 2023
e190b16
Missing the phase_validations.py in the commit somehow
jcadam14 Dec 5, 2023
6ffe84b
Missed black formatting
jcadam14 Dec 5, 2023
1f26af4
Updated E2014 and 2015 to be similar in structure to the CSV
jcadam14 Dec 5, 2023
464eb0b
Corrected capitalization that was corrected in the csv
jcadam14 Dec 6, 2023
62c87f3
Merge branch '68_correct_validation_description_errors' into 65-creat…
jcadam14 Dec 6, 2023
daedb72
Uncapitalizes And in the middle of a description
jcadam14 Dec 6, 2023
43b1314
Merge branch '68_correct_validation_description_errors' into 65-creat…
jcadam14 Dec 6, 2023
284109f
Ruff and Black formatting
jcadam14 Dec 6, 2023
d45a54b
Changed the github path to the csv to the main branch now that the ch…
jcadam14 Dec 13, 2023
cbaed4d
Updated README for details on the FIG CSV comparison unit test.
jcadam14 Dec 28, 2023
6696af8
black linting
jcadam14 Dec 28, 2023
54dee6b
Created a second csv pytest that uses object and the dataframe fields…
jcadam14 Dec 29, 2023
09c173d
Created new pytest file test_csv_to_code_differences.py that redoes h…
jcadam14 Dec 29, 2023
fcaba8b
Ruff linting fixes before merge
jcadam14 Jan 2, 2024
d2869fc
Linting fixes that are different in github than in our local poetry r…
jcadam14 Jan 2, 2024
35f3be9
Fixing differences between local black/ruff linting and github's
jcadam14 Jan 2, 2024
bc3d1d6
Autolinting isn't a good thing unless VSCode and Github agree
jcadam14 Jan 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ coverage.xml

# excel artifact
~$example_sblar.xlsx

errors.csv
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ failed validation.
We use these test files in for automated test, but can also be passed in via the
`cfpb-val` CLI utility for manual testing.


## Development

### Best practices
Expand Down Expand Up @@ -234,6 +233,30 @@ Test coverage details can be found in this project's
branch.


### Testing the FIG CSV

A standard pytest ([`test_csv_differences.py`](tests/test_csv_differences.py)) has been written that compares the validation code in [`phase_validations.py`](regtech_data_validator/phase_validations.py)
to the [`FIG CSV`](https://github.com/cfpb/sbl-content/blob/main/fig-files/validation-spec/2024-validations.csv). This test will check that
the list of validation IDs in one match the other, and will report on IDs that are missing in either.
The test will also validate that all severities (error or warning) match. The test will then
do a hard string compare between the violation descriptions, with a couple of caveats:
- Any python validation check whose description starts with a single quote will first add the single quote
to the CSV's description, if one doesn't exist. This is done because if someone modifies the CSV in Excel,
Excel will drop the beginning single quote, which it interprets as a formatter telling Excel "this field is a string"
- Certain descriptions in the CSV have 'complex' formatting to produce layouts with lists, new lines and white space
that may not compare correctly. Since how error descriptions will be formatted on the results page for a submission,
currently the test will strip off some of this formatting and compare the text.

This test is ran automatically as part of our unit testing pipeline. A developer can also
run the test manually by running the command `poetry run pytest tests/test_csv_differences.py`

This will create an errors.csv file at the root of the repo that can be used to easily view
differences found between the two files.

Normally the pytest will point to the main branch in the sbl-content repo, but a developer
can modify the test to point to a development branch that has upcoming changes, run the test with the above command,
and then evaluate what changes may need to be made to the python validation code.

## Linting

This repository utilizing `black` and `ruff` libraries to check and fix any
Expand Down
Binary file added data/census/raw/CensusFlatFile2023.zip
Binary file not shown.
Loading
Loading