Skip to content

Commit

Permalink
document that doctest_skip_exe() lines should be ignored
Browse files Browse the repository at this point in the history
see #172, #188, #208
  • Loading branch information
xflr6 committed Oct 25, 2023
1 parent a99b02e commit b85a7a8
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Drop Python 3.7 support (end of life 27 Jun 2023).

Tag Python 3.11 and 3.12 support.

Document that `doctest_skip_exe()` lines in doctest should be ignored.


Version 0.20.1
--------------
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ Check the generated source code:
B -> L [constraint=false]
}
Save and render the source code:
Save and render the source code (skip/ignore any ``doctest_mark_exe()`` lines):

.. code:: python
>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line
>>> dot.render('doctest-output/round-table.gv').replace('\\', '/')
'doctest-output/round-table.gv.pdf'
Expand All @@ -115,7 +115,7 @@ Save and render and view the result:

.. code:: python
>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line
>>> dot.render('doctest-output/round-table.gv', view=True) # doctest: +SKIP
'doctest-output/round-table.gv.pdf'
Expand Down
7 changes: 5 additions & 2 deletions docs/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ Use the :meth:`~.Graph.render` method to save the DOT source code
and render it with the default ``dot`` `layout engine <DOT layouts_>`_
(see :ref:`below <engines>` for using other layout engines).

.. attention::
Skip/ignore any ``doctest_mark_exe()`` lines in documentation code examples.

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> dot.render(directory='doctest-output').replace('\\', '/')
'doctest-output/round-table.gv.pdf'
Expand All @@ -78,7 +81,7 @@ for the rendered file type.

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> dot.render(directory='doctest-output', view=True) # doctest: +SKIP
'doctest-output/round-table.gv.pdf'
Expand Down
2 changes: 1 addition & 1 deletion docs/escapes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use the :func:`graphviz.escape` function

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> bs.render(format='svg', directory='doctest-output').replace('\\', '/')
'doctest-output/literal_backslash.gv.svg'
Expand Down
2 changes: 1 addition & 1 deletion docs/existing_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ you can use the :func:`graphviz.render` function.

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> import pathlib
>>> import graphviz
Expand Down
2 changes: 1 addition & 1 deletion docs/formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object:

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> dot = graphviz.Digraph('hello')
>>> dot.edge('hello', 'world')
Expand Down
2 changes: 1 addition & 1 deletion docs/integration_with_viewers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ might **lock** the (PDF, PNG, etc.) file for as long as the viewer is open

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> g.view(tempfile.mktemp('.gv')) # doctest: +SKIP
'C:\\Users\\User\\AppData\\Local\\Temp\\tmp3aoie8d0.gv.pdf'
Expand Down
2 changes: 1 addition & 1 deletion docs/neato_no_op.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ to pass it to the layout command:

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> import graphviz

Expand Down
2 changes: 1 addition & 1 deletion docs/piped_output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ of your :class:`.Graph` or :class:`.Digraph` object:

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> h.pipe(format='pdf')[:4]
b'%PDF'
Expand Down
2 changes: 1 addition & 1 deletion docs/quoting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ parenthesis and apply normal quoting/escaping:

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> d.render(directory='doctest-output').replace('\\', '/')
'doctest-output/diamond.gv.svg'
Expand Down
4 changes: 2 additions & 2 deletions docs/raw_dot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ Use the :meth:`~.Source.render` method to save and render it:

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> src.render('doctest-output/holy-grenade.gv').replace('\\', '/')
'doctest-output/holy-grenade.gv.pdf'

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> src.render('doctest-output/holy-grenade.gv', view=True).replace('\\', '/') # doctest: +SKIP
'doctest-output/holy-grenade.gv.pdf'
Expand Down
2 changes: 1 addition & 1 deletion docs/subgraphs_and_clusters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ and ``encoding``:

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> p = graphviz.Graph('parent', directory='doctest-output')

Expand Down
6 changes: 3 additions & 3 deletions docs/unflatten.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use the :meth:`~.Graph.unflatten` method.

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> w.view() # doctest: +SKIP

Expand All @@ -34,7 +34,7 @@ use the :meth:`~.Graph.unflatten` method.

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> u.view() # doctest: +SKIP

Expand All @@ -54,7 +54,7 @@ with the same basic API as :class:`.Graph` or :class:`.Digraph` objects

.. doctest::

>>> doctest_mark_exe()
>>> doctest_mark_exe() # skip this line

>>> u.view() # doctest: +SKIP

Expand Down

0 comments on commit b85a7a8

Please sign in to comment.