planet-client-python icon indicating copy to clipboard operation
planet-client-python copied to clipboard

add doctest for python code in documentation

Open jreiberkyle opened this issue 4 years ago • 1 comments

We are using markdown for documentation in v2. The documentation contains many code examples that should be tested for correctness. Add doctest for python code in the markdown documentation.

An option to consider: https://pypi.org/project/phmdoctest/

jreiberkyle avatar Mar 10 '21 17:03 jreiberkyle

Looking around, the best option may just be to use python's doctest to doctest interactive code examples with pytest integration. Long examples should be moved to examples/ and referenced via a link from the documentation.

example:

def fcn():
    '''Comment

    ```pycon
    >>> fcn()
    ResultsFromFcn

   ```<endofpycon>

jreiberkyle avatar Mar 18 '21 22:03 jreiberkyle