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

Consider using pytest-mypy-plugins #10

Open
sobolevn opened this issue Sep 11, 2019 · 1 comment
Open

Consider using pytest-mypy-plugins #10

sobolevn opened this issue Sep 11, 2019 · 1 comment

Comments

@sobolevn
Copy link

Hi! Thanks for this awesome project!

I am TypedDjango team member, we maintain types for, well, django. And we do pretty much the same job.

For example, we also test our types the similar way as you do in tests/. We even created a tool called pytest-mypy-plugins (announcing post) to help us with this task. Maybe it will be also helpful to you as well.

That's how the simplest test looks like:

- case: compose_two_wrong_functions
  main: |
    from returns.functions import compose

    def first(num: int) -> float:
        return float(num)

    def second(num: float) -> str:
        return str(num)

    reveal_type(compose(first, second)(1))  # N: builtins.str*

Ask any questions you have!

P.S. This project was listed in awesome-python-stubs list.

@kedder
Copy link
Member

kedder commented Sep 15, 2019

That looks interesting, thank you! The drawback of current mypy-zope tests is that test cases are limited to a single source file. It seems like testing-mypy-types is more flexible in this regard. I'll look closer into migrating tests.

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

No branches or pull requests

2 participants