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

Convert test/test_util.py to pytest #1795

Merged
merged 1 commit into from Apr 12, 2022

Conversation

aucampia
Copy link
Member

@aucampia aucampia commented Apr 9, 2022

Fairly straight forward conversion from unittest to pytest.

This also fixes some issues that were present in the old tests:

  • assertTrue was used instead of assertEqual inside:
    • test_util_from_n3_expectliteralwithdatatypefromint
    • test_util_from_n3_expectliteralwithdatatypefrombool
    • test_util_from_n3_expectliteralmultiline
    • test_util_from_n3_expectliteralwithescapedquote
  • test_util_from_n3_expectliteralwithescapedquote was not comparing
    against the right literal, but this was missed because it was using
    assertTrue instead of assertEqual
  • test_util_from_n3_not_escapes_xf had ("\\I") as a value but this
    was not failing, so it has been moved to test_util_from_n3_not_escapes.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

Fairly straight forward conversion from unittest to pytest.

This also fixes some issues that were present in the old tests:

- `assertTrue` was used instead of `assertEqual` inside:
  - `test_util_from_n3_expectliteralwithdatatypefromint`
  - `test_util_from_n3_expectliteralwithdatatypefrombool`
  - `test_util_from_n3_expectliteralmultiline`
  - `test_util_from_n3_expectliteralwithescapedquote`
- `test_util_from_n3_expectliteralwithescapedquote` was not comparing
  against the right literal, but this was missed because it was using
  `assertTrue` instead of `assertEqual`
- `test_util_from_n3_not_escapes_xf` had `("\\I")` as a value but this
  was not failing, so it has been moved to `test_util_from_n3_not_escapes`.
@aucampia
Copy link
Member Author

aucampia commented Apr 9, 2022

I kept this very conservative, there are much more that can be done to improve all tests, but I also want to make it easy to review, so this is just doing a 1:1 conversion except for places where there are actual problems not just stylistic concerns.

@aucampia aucampia marked this pull request as ready for review April 9, 2022 11:48
@aucampia aucampia added the review wanted This indicates that the PR is ready for review label Apr 9, 2022
@aucampia aucampia merged commit ab727dd into master Apr 12, 2022
@aucampia aucampia deleted the iwana-20220409T1253-test_utils_pytest branch April 14, 2022 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review wanted This indicates that the PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant