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

Document, lint, and fix placement of magic comments in multiline doctests #35181

Merged
merged 14 commits into from
Apr 1, 2023

Conversation

mkoeppe
Copy link
Member

@mkoeppe mkoeppe commented Feb 23, 2023

📚 Description

Fixes #33091

tldr:

  • # optional tags go on the sage: lines.
  • they don't go on the ....: lines.

📝 Checklist

  • I have made sure that the title is self-explanatory and the description concisely explains the PR.
  • I have linked an issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@codecov-commenter
Copy link

codecov-commenter commented Feb 24, 2023

Codecov Report

Base: 88.60% // Head: 88.58% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (af479f2) compared to base (8f5bbd2).
Patch has no changes to coverable lines.

❗ Current head af479f2 differs from pull request most recent head 1308665. Consider uploading reports for the commit 1308665 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #35181      +/-   ##
===========================================
- Coverage    88.60%   88.58%   -0.02%     
===========================================
  Files         2140     2140              
  Lines       397273   397272       -1     
===========================================
- Hits        352004   351937      -67     
- Misses       45269    45335      +66     
Impacted Files Coverage Δ
...omplex_reflection_or_generalized_coxeter_groups.py 95.04% <ø> (ø)
...age/categories/finite_complex_reflection_groups.py 79.12% <ø> (ø)
src/sage/combinat/abstract_tree.py 96.04% <ø> (ø)
src/sage/combinat/crystals/alcove_path.py 93.72% <ø> (ø)
src/sage/combinat/designs/bibd.py 87.83% <ø> (ø)
src/sage/combinat/designs/incidence_structures.py 87.98% <ø> (ø)
src/sage/combinat/designs/orthogonal_arrays.py 90.42% <ø> (ø)
...binat/designs/orthogonal_arrays_build_recursive.py 85.32% <ø> (ø)
src/sage/combinat/designs/resolvable_bibd.py 97.16% <ø> (ø)
...sage/combinat/designs/steiner_quadruple_systems.py 95.68% <ø> (ø)
... and 85 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mkoeppe mkoeppe changed the title Document and fix placement of magic comments in multiline doctests Document, lint, and fix placement of magic comments in multiline doctests Feb 24, 2023
@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

do you have 3a1a03a in the branch? Cause I don't get why you get a test failure. Do you misdetect GAP3 as present?

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

err, still not enough # optional - gap3 tags.

3a1a03ae2cc (Travis Scrimshaw  2023-01-25 10:43:07 +0900  199)             sage: W = ReflectionGroup((3,1,2))            # optional - gap3
14d6f619119 (Travis Scrimshaw  2023-01-26 16:39:54 +0900  200)             sage: data = {w: [w.to_matrix(), w.to_matrix(on_space="dual")] for w in W}  # optional - gap3
3a1a03ae2cc (Travis Scrimshaw  2023-01-25 10:43:07 +0900  201)             sage: for w in W.iteration_tracking_words():  # optional - gap3
3a1a03ae2cc (Travis Scrimshaw  2023-01-25 10:43:07 +0900  202)             ....:     w.reduced_word()                    # optional - gap3
14d6f619119 (Travis Scrimshaw  2023-01-26 16:39:54 +0900  203)             ....:     mats = [w.to_matrix(), w.to_matrix(on_space="dual")]  # optional - gap3
14d6f619119 (Travis Scrimshaw  2023-01-26 16:39:54 +0900  204)             ....:     mats
14d6f619119 (Travis Scrimshaw  2023-01-26 16:39:54 +0900  205)             ....:     assert data[w] == mats

@tobiasdiez
Copy link
Contributor

To reduce these missing optional directives, maybe block level directives would be a handy solution? https://xdoctest.readthedocs.io/en/latest/xdoctest.directive.html

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

To reduce these missing optional directives, maybe block level directives would be a handy solution? https://xdoctest.readthedocs.io/en/latest/xdoctest.directive.html

looks interesting

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

I don't know what's up with relint - has anyone tried running what it suggests?

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

I don't know what's up with relint - has anyone tried running what it suggests?

If you're referring to the messages about namespace packages, this is done in #35105, #35106, #35107, which need review

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

still not enough # optional - gap3 tags.

The new linting rule complains because there are too many of these tags, not too few!

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

[...] maybe block level directives would be a handy solution? https://xdoctest.readthedocs.io/en/latest/xdoctest.directive.html

Thanks for the pointer. More expressive/powerful doctest annotations would of course be helpful. Not really for this ticket, which is about getting rid of too many (and badly placed) directives on multi-line doctests. But definitely for the work in #34998 for the modularization effort.

However, block- and function-scope # optional annotations have been discussed many times over the years, and were rejected / discussed to death each time. At least, we were able to get in file-level annotations (top of file # sage.doctest - optional ...).

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023 via email

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

Fixed what where?

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

pushed straight to develop
added 2 # optional: gap3 tags

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

These tags that you added in c017a6a are wrong.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

And CI did not fail with 10.0.beta2 -- https://github.com/sagemath/sage/actions/runs/4258115923

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023 via email

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023 via email

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

On Fri, 24 Feb 2023, 18:23 Matthias Köppe, @.> wrote: And CI did not fail with 10.0.beta2 -- https://github.com/sagemath/sage/actions/runs/4258115923
yes it did fail, you are probably looking at a different run

— Reply to this email directly, view it on GitHub <#35181 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXYHEWIKJEMEOG2ZRV3O3WZD4BJANCNFSM6AAAAAAVF6EJAY . You are receiving this because you commented.Message ID: @.
>

Dude, of course the build was OK, it's build+test that failed.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

I've pushed the correct fix.

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

Could you please undo the vandalism on the develop branch?

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

no idea what you are talking about. tags were missing there

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

@dimpase
Copy link
Member

dimpase commented Feb 24, 2023

OK, sorry for confusion. I fixed the develop branch, as you might have noticed.

@github-actions
Copy link

Documentation preview for this PR is ready! 🎉
Built with commit: 1308665

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 24, 2023

Thanks! I've merged it already.

Copy link
Contributor

@tornaria tornaria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 26, 2023

Thank you!

@vbraun
Copy link
Member

vbraun commented Mar 23, 2023

Merge conflict, wait for the next beta

orlitzky and others added 14 commits March 27, 2023 11:27
There are a few tests in the sage library that span multiple lines and
that were intended to be marked as "long time", but were not due to an
implementation detail. As it stands, it is the FIRST line of a doctest
that needs to be marked "long time", and not the last.

This commit fixes a few doctests whose last (but not first) lines were
tagged, updating them instead to bear the "# long time" tag on each
line. This is overkill, but will save us time in the event that the
parser is ever changed.
…][.].*#/s/ *# *(arb216|arb218|py2|py3|long time|not implemented|not tested|known bug|optional|indirect doctest).*//'
@mkoeppe
Copy link
Member Author

mkoeppe commented Mar 27, 2023

Trivial rebase, back to positive

@vbraun vbraun merged commit 0ae9698 into sagemath:develop Apr 1, 2023
@mkoeppe mkoeppe added this to the sage-10.0 milestone Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

labels in multiline doctests
7 participants