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

feat: Verify data in tests (row count and first row) #215

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

sebastianswms
Copy link
Contributor

Implement a method to verify data in tests. Currently only checks the total number of rows in a table and the data in the first row. I believe this provides good test coverage while keeping things manageable.

Closes #16

@sebastianswms
Copy link
Contributor Author

#219 and #220 both add new pytests, so additions will need to be made to this PR to verify their data.

target_postgres/tests/test_standard_target.py Show resolved Hide resolved

with engine.connect() as connection:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you want to consolidate the Tests but I think this test had a pretty solid data test and you removed a lot of the checks that were there before. We could just leave this one alone, or you could expand your verify data function to be able to work with multiple rows of data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded to work with multiple rows.

)
assert result.rowcount == number_of_rows
result_dict = remove_metadata_columns(result.first()._asdict())
assert result_dict == check_data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm impressed with Python's dictionary comparisons!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify Data in Tests
2 participants