-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for mypy plugin with pytest-mypy-plugins
- Loading branch information
Showing
7 changed files
with
210 additions
and
13 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
[mypy] | ||
plugins = tiny_api_client.mypy |
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,64 @@ | ||
- case: mypy_plugin_correct_route_param | ||
main: | | ||
from tiny_api_client import get, api_client | ||
@api_client('https://api.example.org') | ||
class MyClient: | ||
@get('/users/{user_id}') | ||
def get_users(self, response: list[str]) -> list[str]: | ||
return response | ||
client = MyClient() | ||
client.get_users(user_id='peterparker') | ||
env: | ||
- PYTHONPATH=$(pwd)/../ | ||
|
||
- case: mypy_plugin_optional_route_param | ||
main: | | ||
from tiny_api_client import get, api_client | ||
@api_client('https://api.example.org') | ||
class MyClient: | ||
@get('/users/{user_id}') | ||
def get_users(self, response: list[str]) -> list[str]: | ||
return response | ||
client = MyClient() | ||
client.get_users() | ||
env: | ||
- PYTHONPATH=$(pwd)/../ | ||
|
||
- case: mypy_plugin_wrong_route_param | ||
main: | | ||
from tiny_api_client import get, api_client | ||
@api_client('https://api.example.org') | ||
class MyClient: | ||
@get('/users/{user_id}') | ||
def get_users(self, response: list[str]) -> list[str]: | ||
return response | ||
client = MyClient() | ||
client.get_users(unknown_id='idk') | ||
env: | ||
- PYTHONPATH=$(pwd)/../ | ||
out: | | ||
main:10: error: Unexpected keyword argument "unknown_id" for "get_users" of "MyClient" [call-arg] | ||
- case: mypy_plugin_wrong_extra_route_param | ||
main: | | ||
from tiny_api_client import get, api_client | ||
@api_client('https://api.example.org') | ||
class MyClient: | ||
@get('/users/{user_id}') | ||
def get_users(self, response: list[str]) -> list[str]: | ||
return response | ||
client = MyClient() | ||
client.get_users(user_id='peterparker', unknown_id='idk') | ||
env: | ||
- PYTHONPATH=$(pwd)/../ | ||
out: | | ||
main:10: error: Unexpected keyword argument "unknown_id" for "get_users" of "MyClient" [call-arg] |
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