sage.schemes: Reformat doctests, add # optional annotations#35314
sage.schemes: Reformat doctests, add # optional annotations#35314vbraun merged 33 commits intosagemath:developfrom
sage.schemes: Reformat doctests, add # optional annotations#35314Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #35314 +/- ##
===========================================
- Coverage 88.62% 87.95% -0.67%
===========================================
Files 2148 2148
Lines 398855 398860 +5
===========================================
- Hits 353480 350815 -2665
- Misses 45375 48045 +2670
... and 34 files with indirect coverage changes 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 in Codecov by Sentry. |
|
Documentation preview for this PR is ready! 🎉 |
| sage: P.<x,y> = AffineSpace(QQ, 2) | ||
| sage: H = Hom(P, P) | ||
| sage: f = H([x^2+y^2, y^2/(1+x)]) | ||
| sage: f = H([x^2 + y^2, y^2/(1+x)]) |
There was a problem hiding this comment.
needs spaces around the second +.
There was a problem hiding this comment.
I'm not adding spaces within nested sums
| sage: A.<x,y> = AffineSpace(CC, 2) | ||
| sage: H = Hom(A, A) | ||
| sage: f = H([(x^2-2)/(x*y), y^2-x]) | ||
| sage: f = H([(x^2-2)/(x*y), y^2 - x]) |
| sage: A.<x,y> = AffineSpace(R, 2) | ||
| sage: H = Hom(A, A) | ||
| sage: f = H([(x^2-2)/y, y^2-x]) | ||
| sage: f = H([(x^2-2)/y, y^2 - x]) |
| sage: E | ||
| Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x over Complex Field with 53 bits of precision | ||
| Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x | ||
| over Complex Field with 53 bits of precision |
There was a problem hiding this comment.
Sometimes I see
Elliptic Curve ...
over ...
Other times
Elliptic Curves ...
over ...
Need to be consistent. Here and elsewhere.
There was a problem hiding this comment.
I am standardizing on the first format now
There was a problem hiding this comment.
Okay for this PR.
But for standardizing how to split a long doctest output and formatting nicely multiline output, I don't know what is right. A related idea is to respect the actual output in the sage terminal. I don't know whether we should or not. This issue perhaps belongs to https://doc.sagemath.org/html/en/developer/coding_basics.html#fine-points-on-styles
There was a problem hiding this comment.
I don't think there's a need for setting a policy for developers; to me, anything in the spectrum between the raw actual output (assisted by sage -fixdoctests) and the delicate doctest poetry that I have attempted here is fine. I don't think there is a downside to reformatting the output with the goal of readability / user experience. There is potential for mild disappointment when users try out an example and the output does not look as pretty as it appears in the documentation. But even then the structure-indicating reformatted output guides the user through parsing the complicated raw output. And Sage has various ways to adjust output, using %display latex, %display ascii_art etc.; the difference between documentation and reality may inspire users to explore these facilities (or even improve our _repr_ code).
| sage: A.<a> = Qp(3).extension(x^3 - 3) | ||
| sage: B(a) | ||
| sage: B = Berkovich_Cp_Affine(3) # optional - sage.rings.padics | ||
| sage: A.<a> = Qp(3).extension(x^3 - 3) # optional - sage.rings.number_field |
There was a problem hiding this comment.
Extensions of p-adic fields seems to still belong to sage.rings.padics.
| from Elliptic Curve defined by y^2 = x^3 + (15*z6^5+5*z6^4+8*z6^3+12*z6^2+11*z6+7)*x | ||
| over Finite Field in z6 of size 17^6 | ||
| to Elliptic Curve defined by y^2 = x^3 + z6*x | ||
| over Finite Field in z6 of size 17^6 |
There was a problem hiding this comment.
No optional tags in this file?
| Isogeny of degree 2 from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 5*x + 2 over Rational Field to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 80*x + 242 over Rational Field | ||
| Isogeny of degree 2 | ||
| from Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 5*x + 2 over Rational Field | ||
| to Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 80*x + 242 over Rational Field |
There was a problem hiding this comment.
No optional tags in this file?
| from Elliptic Curve defined by y^2 = x^3 + 10 over Finite Field in a of size 13^2 | ||
| to Elliptic Curve defined by y^2 = x^3 + (9*a+10)*x + (11*a+12) over Finite Field in a of size 13^2] | ||
|
|
||
| sage: K.<a> = NumberField(x**6 - 320*x**3 - 320) |
There was a problem hiding this comment.
No optional tags in this file?
src/sage/schemes/overview.py
Outdated
| sage: P(S) | ||
| sage: S.<t> = R.quo(x^2 + 5) # optional - sage.rings.number_field | ||
| sage: P.<X,Y,Z> = ProjectiveSpace(2, S) # optional - sage.rings.number_field | ||
| sage: P(S) # optional - sage.rings.number_field |
There was a problem hiding this comment.
S is not really a number field, but a quotient of a polynomial ring.
sage: R.<x> = ZZ[]
sage: S.<t> = R.quo(x^2+5)
sage: type(S)
<class 'sage.rings.polynomial.polynomial_quotient_ring.PolynomialQuotientRing_domain_with_category'>
|
I looked through the changes. They look good to me. This is a lot of work, and a great improvement of the quality of docstrings in the schemes module. |
|
Thanks very much for reviewing this mega-patch! |
…padics}; doctest cosmetics
…test output (ctd.)
…te}.py: Add # optional
… optional - sage.rings.finite_rings
… optional - sage.rings.finite_rings
…nal, reformat doctests
|
Easy rebase. |
|
gh-35443: Fix slow doctests or mark # long time ### 📚 Description A test is supposed to take < 1s or else be marked # long time. Here we consider slow tests taking >> 10s. When possible we fix or change the test to take less time, otherwise we just mark the test as long time. Occasionally we create a new smaller test and keep the original one as long. After this and #35442 the slowest tests are a few taking ~ 10s. The total time to doctest all goes down from 880 to 806 seconds (using `-tp 8 --all`). ~~NOTE: there's a minor merge conflict with #35314 which I will resolve once that PR is merged.~~ ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #35443 Reported by: Gonzalo Tornaría Reviewer(s): Gonzalo Tornaría, Matthias Köppe
📚 Description
Adding doctest tags
# optional - sage.rings.finite_rings,...number_field,...padics.While going through the doctests line by line, I also made the following changes:
sage.schemes.toric, which were formatted for a very narrow layoutThe doctest tags are preparation for being able to test parts of
sage.schemesin a modularized setting, in which not all rings are available. See https://doc.sagemath.org/html/en/developer/packaging_sage_library.html#doctest-only-dependenciesPart of:
📝 Checklist
⌛ Dependencies
sage.rings.function_field: Modularization fixes #35230 (not merged here) for the definition of the featuresage.rings.finite_rings.The mass edits adding
# optionaltags were made using the following Emacs macro.