This at least is being solved in Python: https://www.python.org/dev/peps/pep-0563/
> inline interfaces
Typed dicts in 3.8 look pretty similar at cursory glance https://www.python.org/dev/peps/pep-0589/
I'll definitely play around with it more!
770 karma · joined March 21, 2013
timothycrosley.com
This at least is being solved in Python: https://www.python.org/dev/peps/pep-0563/
> inline interfaces
Typed dicts in 3.8 look pretty similar at cursory glance https://www.python.org/dev/peps/pep-0589/
I'll definitely play around with it more!
I have not used TypeScript, but looking at it's documentation the syntax for type annotations look identical. Would you be willing to expand on why you think its approach is better / how it's different?
This is a very interesting idea I might explore more!
`auto_pytest_magic` is only made available if you have pytest installed. You can enforce this by doing:
pip3 install -U hypothesis-auto[pytest]Simple example:
from my_library import add
from hypothesis_auto import auto_pytest
@auto_pytest()
def test_add(test_case):
add_result = test_case()
if test_case.params.kwargs['number_1'] > 0 and test_case.params.kwargs['number_1']:
assert add_result > test_case.params.kwargs['number_1']
assert add_result > test_case.params.kwargs['number_1']For cases like that it would be best combined with a mock:
@auto_pytest()
def test_add(test_case, mocker):
mocker.patch('db.call')
test_case()
Note that this example utilizes the following pytest extension: https://github.com/pytest-dev/pytest-mockHowever, I would also note, that just because you have some methods that have potentially dangerous side effects, in most large code-bases, not all functions do. Which is why it operates at a function by function basis. You can use this for new pure functions, while continuing to write other tests in the same fashion by hand.
FastAPI has a lot of advantages at this point for someone looking to do the same: https://github.com/tiangolo/fastapi
hug has some catching up to do, some of it just because it got in so early (It needs to be updated to be compatible with mypy and the types defined typing.py!) in any case using typing on API endpoints - independent of how you feel about Dynamic vs Static typing in general, just makes a lot of sense IMHO.
Luckily, you don't have to choose between those two outcomes:
https://github.com/timothycrosley/portray/blob/master/CHANGE...
https://timothycrosley.github.io/pdocs/
Thanks!
~Timothy
https://github.com/timothycrosley/portray/blob/master/CHANGE...
https://timothycrosley.github.io/pdocs/
Thanks!
~Timothy