-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
sage.schemes
: Reformat doctests, add # optional
annotations
#35314
sage.schemes
: Reformat doctests, add # optional
annotations
#35314
Conversation
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. |
sage.schemes
: Add # optional
annotations to doctestssage.schemes
: Reformat doctests, add # optional
annotations
Documentation preview for this PR is ready! 🎉 |
@@ -355,7 +347,7 @@ def _fastpolys(self): | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs spaces around the second +
.
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.
I'm not adding spaces within nested sums
@@ -464,58 +456,56 @@ def homogenize(self, n): | |||
|
|||
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]) |
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.
needs spaces
|
||
:: | ||
|
||
sage: R.<t> = PolynomialRing(ZZ) | ||
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]) |
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.
needs spaces
@@ -146,7 +146,8 @@ class EllipticCurveFactory(UniqueFactory): | |||
|
|||
sage: E = EllipticCurve(CC, [0,0,1,-1,0]) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am standardizing on the first format now
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extensions of p-adic fields seems to still belong to sage.rings.padics
.
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, fixed in ed39a64
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No optional
tags in this file?
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.
Fixed in 5698dfa
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No optional
tags in this file?
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.
Fixed in d5d51b5
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No optional
tags in this file?
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.
Fixed in 289d256
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'>
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.
Indeed, fixed in 5065211
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. |
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.
Thanks very much for reviewing this mega-patch! |
…test output (ctd.)
…te}.py: Add # optional
… optional - sage.rings.finite_rings
… optional - sage.rings.finite_rings
…nal, reformat doctests
c63ad60
to
a9588d1
Compare
Easy rebase. |
|
### 📚 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.schemes
in 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
# optional
tags were made using the following Emacs macro.