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

Convert some examples to doctests #1709

Merged
merged 9 commits into from
Apr 16, 2024
Merged

Conversation

lgoettgens
Copy link
Collaborator

Some progress towards #1683.
I add some comment to non-trivial changes for you to review.

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.87%. Comparing base (f033978) to head (265cbe0).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1709      +/-   ##
==========================================
+ Coverage   84.74%   84.87%   +0.12%     
==========================================
  Files          94       94              
  Lines       37205    37204       -1     
==========================================
+ Hits        31530    31576      +46     
+ Misses       5675     5628      -47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docs/src/exact.md Outdated Show resolved Hide resolved
docs/src/matrix.md Show resolved Hide resolved
src/flint/fmpz_mat.jl Outdated Show resolved Hide resolved
docs/src/matrix.md Outdated Show resolved Hide resolved
docs/src/matrix.md Outdated Show resolved Hide resolved
@lgoettgens
Copy link
Collaborator Author

I have some more stuff prepared locally, but had to run for the train. I'll push it later

@lgoettgens lgoettgens marked this pull request as draft April 5, 2024 15:48
docs/src/exact.md Show resolved Hide resolved
docs/src/exact.md Show resolved Hide resolved
A = S([1 0 1; 2 3 1; 5 6 7])

B, d = pseudo_inv(A)
```
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved to pseudo_inv docstring

c = coeff(d, 1)
is_gen(m)
q = degree(K)
r, s = signature(K)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Has been removed in #778, but they forgot the example

@lgoettgens lgoettgens marked this pull request as ready for review April 5, 2024 17:47
@lgoettgens lgoettgens closed this Apr 9, 2024
@lgoettgens lgoettgens reopened this Apr 9, 2024
```
n = BigInt("1234567898765434567898765434567876543456787654567890")
```jldoctest
julia> n = parse(BigInt, "1234567898765434567898765434567876543456787654567890")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this has been broken all along. the new one doesn't quite fit the text above but I think it is better than something broken


```julia
RR = ArbField(64)
simplest_rational_inside(const_pi(RR))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

example is already in the docstring and thus included 5 lines above

@lgoettgens
Copy link
Collaborator Author

@fingolfin this should be most of them now, at least the non-trivial ones (aka I won't add anything new to this PR, only CI fixes). Everything needing a doctestfilter (like rand) I skipped for now. I highlighted some non-trivial changes with comments. If you are fine with it, please go ahead and merge :)

docs/src/acb.md Outdated Show resolved Hide resolved
Co-authored-by: Max Horn <max@quendi.de>
docs/src/acb.md Outdated Show resolved Hide resolved
docs/src/constructors.md Outdated Show resolved Hide resolved
julia> a = sqrt(C(2)) + 1;

julia> cos(a) + cos(2*a) + cos(3*a) == sin(7*a//2)//(2*sin(a//2)) - C(1)//2
true

julia> sin(3*a) == 4 * sin(a) * sin(C(pi)//3 - a) * sin(C(pi)//3 + a)
ERROR: Unable to perform operation (failed deciding truth of a predicate): isequal
[...]
Copy link
Member

Choose a reason for hiding this comment

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

Just out of curiosity, why add these [...] to errors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://documenter.juliadocs.org/dev/man/doctests/#Exceptions told me

To indicate to readers that the output result is truncated and does not display the entire (or any of) the stacktrace you may write [...] at the line where checking should stop, i.e.

and I liked that

@thofma
Copy link
Member

thofma commented Apr 12, 2024

If it works it works. I will merge tomorrow unless someone objects.

@fingolfin fingolfin merged commit f3683d0 into Nemocas:master Apr 16, 2024
25 of 26 checks passed
@lgoettgens lgoettgens deleted the lg/doctests branch April 17, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants