-
-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
[MRG] Doctest with print change only adjusts default options for doctest #13991
[MRG] Doctest with print change only adjusts default options for doctest #13991
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
I like this, btw... I think it makes doctest maintenance much more straightforward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @thomasjpfan , this is very nice!
(Fixed a last few occurrences of +ELLIPSIS
)
Opened a follow-up issue in #14008 about using |
Reference Issues/PRs
Fixes #13985
Fixes #13564
What does this implement/fix? Explain your changes.
This PR changes:
NORMALIZE_WHITESPACE
andELLIPSIS
the default options.print_changed_only=True
for doctest.Any other comments?
This PR only changes
print_changed_only
on doctests, and not normal tests.