Always Skip doctests which depend on Qt and are in the class doc string

The doc test skip directive modifies the __doc__ attribute, which is not
possible for new-stlye classes.
This commit is contained in:
Johannes Schönberger
2014-03-13 18:29:54 -04:00
parent f280e0b13e
commit ece0f30af3
2 changed files with 5 additions and 7 deletions
+4 -5
View File
@@ -16,7 +16,6 @@ else:
has_qt = False
@doctest_skip_parser
class Plugin(QtGui.QDialog):
"""Base class for plugins that interact with an ImageViewer.
@@ -60,12 +59,12 @@ class Plugin(QtGui.QDialog):
>>> from skimage import data
>>>
>>> plugin = Plugin(image_filter=lambda img,
... threshold: img > threshold) # skip if not has_qt
>>> plugin += Slider('threshold', 0, 255) # skip if not has_qt
... threshold: img > threshold) # doctest: +SKIP
>>> plugin += Slider('threshold', 0, 255) # doctest: +SKIP
>>>
>>> image = data.coins()
>>> viewer = ImageViewer(image) # skip if not has_qt
>>> viewer += plugin # skip if not has_qt
>>> viewer = ImageViewer(image) # doctest: +SKIP
>>> viewer += plugin # doctest: +SKIP
>>> viewer.show() # doctest: +SKIP
The plugin will automatically delegate parameters to `image_filter` based
+1 -2
View File
@@ -51,7 +51,6 @@ def mpl_image_to_rgba(mpl_image):
return img_as_float(image)
@doctest_skip_parser
class ImageViewer(QtGui.QMainWindow):
"""Viewer for displaying images.
@@ -79,7 +78,7 @@ class ImageViewer(QtGui.QMainWindow):
--------
>>> from skimage import data
>>> image = data.coins()
>>> viewer = ImageViewer(image) # skip if not has_qt
>>> viewer = ImageViewer(image) # doctest: +SKIP
>>> viewer.show() # doctest: +SKIP
"""