Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctest failures in tutorial #6927

Closed
jnothman opened this issue Jun 22, 2016 · 3 comments
Closed

Doctest failures in tutorial #6927

jnothman opened this issue Jun 22, 2016 · 3 comments
Labels
Documentation Easy Well-defined and straightforward way to resolve

Comments

@jnothman
Copy link
Member

As peripherally reported at #6924, there can be some small doctest failures in one tutorial:

Doctest: unsupervised_learning.rst ... ok
Doctest: working_with_text_data.rst ... /home/moose/GitHub/scikit-learn/doc/tutorial/text_analytics/working_with_text_data.rst:1: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future
  .. _text_data_tutorial:
FAIL

======================================================================
FAIL: Doctest: working_with_text_data.rst
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for working_with_text_data.rst
  File "/home/moose/GitHub/scikit-learn/doc/tutorial/text_analytics/working_with_text_data.rst", line 0

----------------------------------------------------------------------
File "/home/moose/GitHub/scikit-learn/doc/tutorial/text_analytics/working_with_text_data.rst", line 99, in working_with_text_data.rst
Failed example:
    twenty_train = fetch_20newsgroups(subset='train',
        categories=categories, shuffle=True, random_state=42)
Expected nothing
Got:
    Downloading 20news dataset. This may take a few minutes.
----------------------------------------------------------------------
File "/home/moose/GitHub/scikit-learn/doc/tutorial/text_analytics/working_with_text_data.rst", line 452, in working_with_text_data.rst
Failed example:
    gs_clf.best_score_
Expected:
    0.900...
Got:
    0.90000000000000002

>>  raise self.failureException(self.format_failure(<StringIO.StringIO instance at 0x7fb149ea1d88>.getvalue()))

-------------------- >> begin captured logging << --------------------
sklearn.datasets.twenty_newsgroups: WARNING: Downloading dataset from http://people.csail.mit.edu/jrennie/20Newsgroups/20news-bydate.tar.gz (14 MB)
sklearn.datasets.twenty_newsgroups: INFO: Decompressing /home/moose/scikit_learn_data/20news_home/20news-bydate.tar.gz
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 38 tests in 43.950s

FAILED (SKIP=3, failures=1)
Makefile:40: recipe for target 'test-doc' failed

@jnothman jnothman added Easy Well-defined and straightforward way to resolve Documentation labels Jun 22, 2016
@jnothman
Copy link
Member Author

jnothman commented Jun 23, 2016

Apparently the second failure here was addressed in #6923.

The first failure depends on the state of the machine running the test. Personally, I think it's bad practice for our libraries, including datasets, to be printing to stdout. I'm going to make an issue for that instead.

@crodjer
Copy link
Contributor

crodjer commented Jun 23, 2016

@jnothman I faced the downloading dataset error now. The first time, I had already downloaded it because I was going through the tutorial.
I suspect the prints here should be log info statements instead? I can incorporate that in the PR #6923 (or a separate one?) as well.

@jnothman
Copy link
Member Author

You're welcome to fix just that one in #6923. But the more generic issue is now raised in #6929

crodjer added a commit to crodjer/scikit-learn that referenced this issue Jun 23, 2016
 - Fix a typo.
 - Fix a floating point error in doctests.
 - Fix `VisibleDepricationWarning` due to conversion of an array with
   ndim > 0 to an index.
 - Convert `print` to `log` to avoid doctests failure.

Fixes: scikit-learn#6927

Signed-off-by: Rohan Jain <crodjer@gmail.com>
jnothman pushed a commit that referenced this issue Jun 23, 2016
 - Fix a typo.
 - Fix a floating point error in doctests.
 - Fix `VisibleDepricationWarning` due to conversion of an array with
   ndim > 0 to an index.
 - Convert `print` to `log` to avoid doctests failure.

Fixes: #6927

Signed-off-by: Rohan Jain <crodjer@gmail.com>
olologin pushed a commit to olologin/scikit-learn that referenced this issue Aug 24, 2016
 - Fix a typo.
 - Fix a floating point error in doctests.
 - Fix `VisibleDepricationWarning` due to conversion of an array with
   ndim > 0 to an index.
 - Convert `print` to `log` to avoid doctests failure.

Fixes: scikit-learn#6927

Signed-off-by: Rohan Jain <crodjer@gmail.com>
TomDLT pushed a commit to TomDLT/scikit-learn that referenced this issue Oct 3, 2016
 - Fix a typo.
 - Fix a floating point error in doctests.
 - Fix `VisibleDepricationWarning` due to conversion of an array with
   ndim > 0 to an index.
 - Convert `print` to `log` to avoid doctests failure.

Fixes: scikit-learn#6927

Signed-off-by: Rohan Jain <crodjer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Easy Well-defined and straightforward way to resolve
Projects
None yet
Development

No branches or pull requests

2 participants