From b95b2b8c0575e7e43e8541f15b25160d62d0af18 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Thu, 21 May 2009 13:35:48 +0000 Subject: sphinxext/numpydoc: wrap Examples in plot:: if they contain matplotlib example code --- doc/sphinxext/tests/test_docscrape.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'doc/sphinxext/tests/test_docscrape.py') diff --git a/doc/sphinxext/tests/test_docscrape.py b/doc/sphinxext/tests/test_docscrape.py index 15c9b17f4..4a1f64cf5 100644 --- a/doc/sphinxext/tests/test_docscrape.py +++ b/doc/sphinxext/tests/test_docscrape.py @@ -488,3 +488,24 @@ def test_unicode(): """) assert doc['Summary'][0] == u'öäöäöäöäöåååå'.encode('utf-8') + +def test_plot_examples(): + doc = SphinxDocString(""" + Examples + -------- + >>> import matplotlib.pyplot as plt + >>> plt.plot([1,2,3],[4,5,6]) + >>> plt.show() + """) + assert 'plot::' in str(doc), str(doc) + + doc = SphinxDocString(""" + Examples + -------- + .. plot:: + + import matplotlib.pyplot as plt + plt.plot([1,2,3],[4,5,6]) + plt.show() + """) + assert str(doc).count('plot::') == 1, str(doc) -- cgit v1.2.1