8000 FIX: doctests under Windows 64bit · seckcoder/scikit-learn@3f9d73d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f9d73d

Browse files
committed
FIX: doctests under Windows 64bit
Thanks to @bdholt1 for reporting these errors
1 parent 70bf00c commit 3f9d73d

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

sklearn/datasets/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def load_digits(n_class=10):
283283
284284
>>> from sklearn.datasets import load_digits
285285
>>> digits = load_digits()
286-
>>> digits.data.shape
286+
>>> print digits.data.shape
287287
(1797, 64)
288288
>>> import pylab as pl #doctest: +SKIP
289289
>>> pl.gray() #doctest: +SKIP
@@ -391,7 +391,7 @@ def load_boston():
391391
--------
392392
>>> from sklearn.datasets import load_boston
393393
>>> boston = load_boston()
394-
>>> boston.data.shape
394+
>>> print boston.data.shape
395395
(506, 13)
396396
"""
397397
module_path = dirname(__file__)

sklearn/datasets/samples_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def make_blobs(n_samples=100, n_features=2, centers=3, cluster_std=1.0,
622622
>>> from sklearn.datasets.samples_generator import make_blobs
623623
>>> X, y = make_blobs(n_samples=10, centers=3, n_features=2,
624624
... random_state=0)
625-
>>> X.shape
625+
>>> print X.shape
626626
(10, 2)
627627
>>> y
628628
array([0, 0, 1, 0, 2, 2, 2, 1, 1, 0])

sklearn/feature_extraction/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def extract_patches_2d(image, patch_size, max_patches=None, random_state=None):
223223
[ 8, 9, 10, 11],
224224
[12, 13, 14, 15]])
225225
>>> patches = image.extract_patches_2d(one_image, (2, 2))
226-
>>> patches.shape
226+
>>> print patches.shape
227227
(9, 2, 2)
228228
>>> patches[0]
229229
array([[0, 1],

sklearn/metrics/cluster/tests/test_supervised.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
]
2828

2929

30-
def assert_raise_message(exception, message, callable, *args, **kwargs):
30+
def assert_raise_message(exception, message_start, callable, *args, **kwargs):
3131
"""Helper function to test error messages in exceptions"""
3232
try:
3333
callable(*args, **kwargs)
34-
raise AssertionError("Should have raised %r" % exception(message))
34+
raise AssertionError("Should have raised %r..." %
35+
exception(message_start))
3536
except exception as e:
36-
assert str(e) == message
37+
assert str(e).startswith(message_start)
3738

3839

3940
def test_error_messages_on_wrong_input():
@@ -43,11 +44,11 @@ def test_error_messages_on_wrong_input():
4344
assert_raise_message(ValueError, expected, score_func,
4445
[0, 1], [1, 1, 1])
4546

46-
expected = "labels_true must be 1D: shape is (2, 2)"
47+
expected = "labels_true must be 1D: shape is (2"
4748
assert_raise_message(ValueError, expected, score_func,
4849
[[0, 1], [1, 0]], [1, 1, 1])
4950

50-
expected = "labels_pred must be 1D: shape is (2, 2)"
51+
expected = "labels_pred must be 1D: shape is (2"
5152
assert_raise_message(ValueError, expected, score_func,
5253
[0, 1, 0], [[1, 1], [0, 0]])
5354

sklearn/preprocessing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ class LabelEncoder(BaseEstimator, TransformerMixin):
541541
LabelEncoder()
542542
>>> le.classes_
543543
array([1, 2, 6])
544-
>>> le.transform([1, 1, 2, 6])
545-
array([0, 0, 1, 2])
544+
>>> le.transform([1, 1, 2, 6]) #doctest: +ELLIPSIS
545+
array([0, 0, 1, 2]...)
546546
>>> le.inverse_transform([0, 0, 1, 2])
547547
array([1, 1, 2, 6])
548548
@@ -554,8 +554,8 @@ class LabelEncoder(BaseEstimator, TransformerMixin):
554554
LabelEncoder()
555555
>>> list(le.classes_)
556556
['amsterdam', 'paris', 'tokyo']
557-
>>> le.transform(["tokyo", "tokyo", "paris"])
558-
array([2, 2, 1])
557+
>>> le.transform(["tokyo", "tokyo", "paris"]) #doctest: +ELLIPSIS
558+
array([2, 2, 1]...)
559559
>>> list(le.inverse_transform([2, 2, 1]))
560560
['tokyo', 'tokyo', 'paris']
561561

sklearn/utils/arpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ def _eigsh(A, k=6, M=None, sigma=None, which='LM', v0=None,
14091409
>>> vals, vecs = eigsh(id, k=6)
14101410
>>> vals # doctest: +SKIP
14111411
array([ 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j])
1412-
>>> vecs.shape
1412+
>>> print vecs.shape
14131413
(13, 6)
14141414
14151415
References

0 commit comments

Comments
 (0)
0