Repository navigation
[MRG] Doctest with print change only adjusts default options for doctest - #13991
Merged
Merged
Conversation
Member
|
why did you change two things :-/ I assume the global doctest options are non-controversial while the change only might be. Also: I really hope you did this automatically ;) Personally I think this is much more informative. A possible source of confusion could be that locally people get different outputs. |
amueller
approved these changes
May 30, 2019
NicolasHug
approved these changes
May 30, 2019
jnothman
reviewed
May 31, 2019
jnothman
left a comment
Member
There was a problem hiding this comment.
There still appear to be some flags used in doctests in this PR:
doc/modules/linear_model.rst: >>> reg.intercept_ #doctest: +ELLIPSIS
doc/modules/model_evaluation.rst: >>> hinge_loss(y_true, pred_decision, labels) #doctest: +ELLIPSIS
setup.cfg:doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
sklearn/datasets/descr/twenty_newsgroups.rst: >>> vectors.nnz / float(vectors.shape[0]) # doctest: +ELLIPSIS
sklearn/datasets/descr/twenty_newsgroups.rst: >>> metrics.f1_score(newsgroups_test.target, pred, average='macro') # doctest: +ELLIPSIS
sklearn/datasets/descr/twenty_newsgroups.rst: >>> metrics.f1_score(pred, newsgroups_test.target, average='macro') # doctest: +ELLIPSIS
sklearn/datasets/descr/twenty_newsgroups.rst: >>> metrics.f1_score(newsgroups_test.target, pred, average='macro') # doctest: +ELLIPSIS
sklearn/metrics/classification.py: >>> hinge_loss(y_true, pred_decision, labels) #doctest: +ELLIPSIS
sklearn/metrics/pairwise.py: >>> manhattan_distances([[3]], [[3]])#doctest:+ELLIPSIS
sklearn/metrics/pairwise.py: >>> manhattan_distances([[3]], [[2]])#doctest:+ELLIPSIS
sklearn/metrics/pairwise.py: >>> manhattan_distances([[2]], [[3]])#doctest:+ELLIPSIS
sklearn/metrics/pairwise.py: [[1, 2], [0, 3]])#doctest:+ELLIPSIS
sklearn/metrics/pairwise.py: >>> manhattan_distances(X, y, sum_over_features=False)#doctest:+ELLIPSIS
sklearn/neighbors/unsupervised.py: >>> neigh.fit(samples) #doctest: +ELLIPSIS
sklearn/neighbors/unsupervised.py: ... #doctest: +ELLIPSIS
sklearn/preprocessing/label.py: >>> le.transform([1, 1, 2, 6]) #doctest: +ELLIPSIS
sklearn/preprocessing/label.py: >>> le.transform(["tokyo", "tokyo", "paris"]) #doctest: +ELLIPSIS
sklearn/utils/__init__.py: >>> list(gen_even_slices(10, 10)) #doctest: +ELLIPSIS
sklearn/utils/__init__.py: >>> list(gen_even_slices(10, 5)) #doctest: +ELLIPSIS
setup.cfg:doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS
sklearn/linear_model/coordinate_descent.py: ... #doctest: +NORMALIZE_WHITESPACE
sklearn/linear_model/coordinate_descent.py: ... #doctest: +NORMALIZE_WHITESPACE
sklearn/linear_model/sag.py: ... #doctest: +NORMALIZE_WHITESPACE
sklearn/linear_model/sag.py: ... #doctest: +NORMALIZE_WHITESPACE
sklearn/linear_model/stochastic_gradient.py: ... #doctest: +NORMALIZE_WHITESPACE
sklearn/linear_model/stochastic_gradient.py: ... #doctest: +NORMALIZE_WHITESPACE
sklearn/svm/classes.py: >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE
sklearn/svm/classes.py: >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE
sklearn/svm/classes.py: >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE
sklearn/svm/classes.py: >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE
|
|
||
|
|
||
| def pytest_runtest_teardown(item, nextitem): | ||
| if isinstance(item, DoctestItem): |
Member
|
I like this, btw... I think it makes doctest maintenance much more straightforward. |
rth
approved these changes
Jun 1, 2019
rth
left a comment
Member
There was a problem hiding this comment.
Thanks @thomasjpfan , this is very nice!
(Fixed a last few occurrences of +ELLIPSIS)
Member
|
Opened a follow-up issue in #14008 about using |
Member
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Reference Issues/PRs
Fixes #13985
Fixes #13564
What does this implement/fix? Explain your changes.
This PR changes:
NORMALIZE_WHITESPACEandELLIPSISthe default options.print_changed_only=Truefor doctest.Any other comments?
This PR only changes
print_changed_onlyon doctests, and not normal tests.