returns
returns copied to clipboard
Move several examples from the docs to tests and then `literalinclude` them
We have several quite large examples that live in our docs:
- https://github.com/dry-python/returns/blob/master/docs/pages/future.rst#futureresult
Numberexample from: https://github.com/dry-python/returns/blob/master/docs/pages/contrib/hypothesis_plugins.rst#check_all_laws- https://github.com/dry-python/returns/blob/master/docs/pages/context.rst#requirescontextfutureresult-container
What needs to be done?
- We need to extract these examples from docs to
tests/test_docsfolder - Instead, we should add this:
.. literalinclude:: ../../tests/test_docs/test_${SOME_NEW_FILENAME}.py
:linenos:
- Provide a link to the source code on github somewhere near the example itself
- Possibly we would need to add some dev-dependencies to both
pyproject.tomlanddocs/requirements.txt - Make sure that it is checked by
flake8,mypy, andpytest. And that it actually works.
This way we would have nice, complex, but working examples! 📖
Hi, we should paste this :
.. literalinclude:: ../../tests/test_docs/test_${SOME_NEW_FILENAME}.py :linenos:
instead of examples, or only add near. In a nutshell, what result have to be?
In a nuthshell, we have to create a similar structure of all of the examples in my original post:
- Files: https://github.com/dry-python/returns/tree/master/tests/test_examples
- Includes: https://github.com/dry-python/returns/blob/master/docs/pages/create-your-own-container.rst#step-3-new-interfaces
Do you want to work on this?