From 7b1562495a6a2dc70982d20963e12ef74a8898f6 Mon Sep 17 00:00:00 2001
From: Fabian Pedregosa <fabian.pedregosa@inria.fr>
Date: Wed, 14 Sep 2011 18:22:35 +0200
Subject: [PATCH] FIX: some sklear.test() fixes.

sklearn.test() seems to be very picky to doctest that don't print and
other minor stuff.
---
 sklearn/datasets/base.py            | 9 ++++++---
 sklearn/datasets/mldata.py          | 2 +-
 sklearn/feature_extraction/image.py | 3 ++-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/sklearn/datasets/base.py b/sklearn/datasets/base.py
index 549671381c..98b3141168 100644
--- a/sklearn/datasets/base.py
+++ b/sklearn/datasets/base.py
@@ -244,7 +244,8 @@ def load_digits(n_class=10):
 
     >>> from sklearn.datasets import load_digits
     >>> digits = load_digits()
-
+    >>> digits.data.shape
+    (1797, 64)
     >>> # import pylab as pl
     >>> # pl.gray()
     >>> # pl.matshow(digits.images[0]) # Visualize the first image
@@ -332,7 +333,9 @@ def load_boston():
     Examples
     --------
     >>> from sklearn.datasets import load_boston
-    >>> data = load_boston()
+    >>> boston = load_boston()
+    >>> boston.data.shape
+    (506, 13)
     """
     module_path = dirname(__file__)
     data_file = csv.reader(open(join(module_path, 'data',
@@ -381,7 +384,6 @@ def load_sample_images():
     (427, 640, 3)
     >>> first_img_data.dtype
     dtype('uint8')
-
     >>> # import pylab as pl
     >>> # pl.gray()
     >>> # pl.matshow(dataset.images[0]) # Visualize the first image
@@ -413,6 +415,7 @@ def load_sample_images():
 def load_sample_image(image_name):
     """Load the numpy array of a single sample image
 
+    >>> from sklearn.datasets import load_sample_image
     >>> china = load_sample_image('china.jpg')
     >>> china.dtype
     dtype('uint8')
diff --git a/sklearn/datasets/mldata.py b/sklearn/datasets/mldata.py
index dc8b3054b8..7a4f1ae621 100644
--- a/sklearn/datasets/mldata.py
+++ b/sklearn/datasets/mldata.py
@@ -80,7 +80,7 @@ def fetch_mldata(dataname, target_name='label', data_name='data',
     Load the 'iris' dataset from mldata.org:
     >>> from sklearn.datasets.mldata import fetch_mldata
     >>> iris = fetch_mldata('iris')
-    >>> print iris.target[0]
+    >>> iris.target[0]
     1
     >>> print iris.data[0]
     [-0.555556  0.25     -0.864407 -0.916667]
diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py
index 0a6525e116..8ec6ab0b8c 100644
--- a/sklearn/feature_extraction/image.py
+++ b/sklearn/feature_extraction/image.py
@@ -208,13 +208,14 @@ def extract_patches_2d(image, patch_size, max_patches=None, random_state=None):
     Examples
     --------
 
+    >>> from sklearn.feature_extraction import image
     >>> one_image = np.arange(16).reshape((4, 4))
     >>> one_image
     array([[ 0,  1,  2,  3],
            [ 4,  5,  6,  7],
            [ 8,  9, 10, 11],
            [12, 13, 14, 15]])
-    >>> patches = extract_patches_2d(one_image, (2, 2))
+    >>> patches = image.extract_patches_2d(one_image, (2, 2))
     >>> patches.shape
     (9, 2, 2)
     >>> patches[0]
-- 
GitLab