returns icon indicating copy to clipboard operation
returns copied to clipboard

Move several examples from the docs to tests and then `literalinclude` them

Open sobolevn opened this issue 5 years ago • 2 comments

We have several quite large examples that live in our docs:

  1. https://github.com/dry-python/returns/blob/master/docs/pages/future.rst#futureresult
  2. Number example from: https://github.com/dry-python/returns/blob/master/docs/pages/contrib/hypothesis_plugins.rst#check_all_laws
  3. 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_docs folder
  • 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.toml and docs/requirements.txt
  • Make sure that it is checked by flake8, mypy, and pytest. And that it actually works.

This way we would have nice, complex, but working examples! 📖

sobolevn avatar Oct 10 '20 15:10 sobolevn

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?

ssyrota avatar Oct 12 '20 08:10 ssyrota

In a nuthshell, we have to create a similar structure of all of the examples in my original post:

  1. Files: https://github.com/dry-python/returns/tree/master/tests/test_examples
  2. 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?

sobolevn avatar Oct 12 '20 08:10 sobolevn