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

Add unit tests to mypy targets; fix typing in tests (part of #116) #121

Merged
merged 4 commits into from
May 6, 2024

Conversation

binaryDiv
Copy link
Contributor

This is a follow up PR to #120, which solves another part of #116.

It adds the unit tests to the targets of mypy and fixes typing issues in those files.

There are two rules that are ignored for now:

  1. Untyped definitions are allowed in the unit tests, e.g. you don't need to specify parameter types and the return type for test functions (def test_something(input_data): is sufficient). This is because a) the return type is always None anyway, and b) for a lot of the test parameters it would make sense to use Any anyway.
  2. assignment errors are ignored. This is the main issue of using validataclass and mypy in a project. Defining a validataclass with e.g. foo: int = IntegerValidator() will result in a type error, because mypy thinks we assign an IntegerValidator object to an attribute that has the type int. To solve this, we probably need a custom mypy-validataclass integration, which will be the main and last part of Support for mypy #116.

@binaryDiv binaryDiv added testing Related to testing (e.g. unit tests) refactoring Code refactoring, clean up and other code maintenance work. labels Apr 30, 2024
@binaryDiv binaryDiv self-assigned this Apr 30, 2024
@binaryDiv binaryDiv force-pushed the 116-mypy-unit-test-fixes branch from 1a95f29 to 5f9864c Compare April 30, 2024 15:16
@binaryDiv binaryDiv requested a review from flauschzelle April 30, 2024 15:22
@binaryDiv binaryDiv merged commit 6fa48d5 into main May 6, 2024
7 checks passed
@binaryDiv binaryDiv deleted the 116-mypy-unit-test-fixes branch May 6, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactoring, clean up and other code maintenance work. testing Related to testing (e.g. unit tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants