diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-05-21 13:35:48 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-05-21 13:35:48 +0000 |
commit | b95b2b8c0575e7e43e8541f15b25160d62d0af18 (patch) | |
tree | 53ba1d27759dfed975229e347fdd2b716be9792d /doc/sphinxext/tests/test_docscrape.py | |
parent | e3377d609ae70ad2bbe312b983a41c8bcae8bd6b (diff) | |
download | numpy-b95b2b8c0575e7e43e8541f15b25160d62d0af18.tar.gz |
sphinxext/numpydoc: wrap Examples in plot:: if they contain matplotlib example code
Diffstat (limited to 'doc/sphinxext/tests/test_docscrape.py')
-rw-r--r-- | doc/sphinxext/tests/test_docscrape.py | 21 |
1 files changed, 21 insertions, 0 deletions
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) |