Premise:I saw the “`doctest“` code block in README.md via autocompletion in IntelliJ IDEA and was just wondering what does it entail.
Intuition: It helps directly run doctests.
Problem: As there is not play button on the gutter, I was not able to run the doctests.
I tried to run the doctests from the markdown file in shell using the command:
pytest -m doctest -v README.md
And the tests still didn’t run.
My Readme.md
file contents:
>>> print('Hello')
This test should fail since there was no string provided for the match.
Question:
- What is this code-block-markdown of “`doctest“` really for?
- How to use it to make my document testable?