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 # optional / # long annotation dataflow checker #35401

Closed
1 task done
mkoeppe opened this issue Mar 30, 2023 · 0 comments · Fixed by #35620
Closed
1 task done

Doctest # optional / # long annotation dataflow checker #35401

mkoeppe opened this issue Mar 30, 2023 · 0 comments · Fixed by #35620

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 30, 2023

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Problem Description

It is easy to make mistakes when using # optional - FEATURE and # long time annotations in doctests.

For example, in the following doctests, a # long time annotation is missing, causing a failure when sage -t is used without --long.

src/sage/coding/ag_code_decoders.pyx:    sage: code = codes.EvaluationAGCode(pls, G)  # long time
src/sage/coding/ag_code_decoders.pyx:    sage: code                                   # long time
src/sage/coding/ag_code_decoders.pyx-    [26, 15] evaluation AG code over GF(9)
src/sage/coding/ag_code_decoders.pyx:    sage: decoder = code.decoder('K')
src/sage/coding/ag_code_decoders.pyx:    sage: tau = decoder.decoding_radius()        # long time
src/sage/coding/ag_code_decoders.pyx:    sage: tau                                    # long time

As part of

we expect to add many more # optional annotations corresponding to "standard" packages such as # optional - scipy and corresponding to subset distributions such as # optional - sage.libs.pari.

Proposed Solution

The Sage doctester has a rudimentary data flow analyzer for the globals involved in the lines of a doctest, globs: RecordingDict, which is used for determining dependencies for parallelization purposes.

We can extend this mechanism to track the set of features (# optional tags) and the pseudo-feature long associated with each doctest line. For each variable in RecordingDict.got of a doctest_line, we check that the set of required features

  • is a superset of the set of required features of a predecessor of doctest_line that has variable in predecessor.globs.set,
  • or a proper generalization of this.

Alternatives Considered

N/A

Additional Information

No response

@mkoeppe mkoeppe changed the title Doctest # optional / # long annotation checker/fixer Doctest # optional / # long annotation dataflow checker Jun 17, 2023
@vbraun vbraun closed this as completed in 1c782f2 Jun 21, 2023
@mkoeppe mkoeppe added this to the sage-10.1 milestone Jun 21, 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 a pull request may close this issue.

1 participant