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

pretty printing for maps #1424

Merged
merged 5 commits into from
Sep 13, 2023
Merged

Conversation

simonbrandhorst
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #1424 (0c9e15a) into master (723898c) will decrease coverage by 0.10%.
Report is 10 commits behind head on master.
The diff coverage is 38.88%.

@@            Coverage Diff             @@
##           master    #1424      +/-   ##
==========================================
- Coverage   84.55%   84.46%   -0.10%     
==========================================
  Files         108      109       +1     
  Lines       29209    29365     +156     
==========================================
+ Hits        24697    24802     +105     
- Misses       4512     4563      +51     
Files Changed Coverage Δ
src/generic/Map.jl 56.75% <29.03%> (-18.25%) ⬇️
src/generic/MapWithInverse.jl 90.90% <100.00%> (-1.69%) ⬇️

... and 28 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@simonbrandhorst
Copy link
Contributor Author

@thofma @fingolfin

@simonbrandhorst simonbrandhorst changed the title pretty printing for FunctionalMap pretty printing for maps Sep 12, 2023
Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

A bunch of doctests need to be resolved. I suggest we first merge #1431 and then adjust all in one go via doctest(:fix)

src/Attributes.jl Outdated Show resolved Hide resolved
src/generic/Map.jl Outdated Show resolved Hide resolved
src/Attributes.jl Outdated Show resolved Hide resolved
print(io, " -> ", Lowercase(), domain(h))
h = map2(h)
end
print(io, " -> ", Lowercase(), codomain(M))
Copy link
Member

Choose a reason for hiding this comment

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

Seem this function is not tested at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. Our coverage of show methods isn't great. But then there are various opinions on whether/how these should be tested.

Copy link
Member

Choose a reason for hiding this comment

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

There are? I thought this is pretty clear: they are tested via doctests in suitable places? That was actually the motivation for PR #1431 -- with that merged, more of the code in this PR here will be tested :-).

But to be clear, I did not intend this to be a blocker for merging. We will try to merge this PR here today before the new breaking AA release

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember adding doctests for a show method and someone complained.

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't add a doctest just for the show method; but usually there are other doctests which create objects that are printed by that show method, and so we get tests as a side effect. E.g. PR #1431 adds doctest as examples in the docstring of identity_hom, compose and map_from_func.

simonbrandhorst and others added 2 commits September 13, 2023 08:44
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Max Horn <max@quendi.de>
else
io = pretty(io)
print(io, "Map: ", Lowercase(), domain(M))
h = map2(m)
Copy link
Member

Choose a reason for hiding this comment

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

Tests are good, even for "obvious" code, as they uncover bugs like this one:

Suggested change
h = map2(m)
h = map2(M)

I'll push a fix and adjusted doctests in a moment. Since PR #1431 seems to have stalled :-( I'd rather get this PR here ready ASAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@simonbrandhorst
Copy link
Contributor Author

Let me know if I should do anything.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

All looks good

@thofma thofma merged commit 15764fd into Nemocas:master Sep 13, 2023
13 of 15 checks passed
lgoettgens added a commit to oscar-system/Oscar.jl that referenced this pull request Sep 13, 2023
lgoettgens added a commit to oscar-system/Oscar.jl that referenced this pull request Sep 14, 2023
thofma pushed a commit to oscar-system/Oscar.jl that referenced this pull request Sep 14, 2023
* Bump compats

* Remove functions moved to Nemo (Nemocas/Nemo.jl#1519)

* Fix `ZZ` printing (Nemocas/Nemo.jl#1506)

* Fix `identity_map` docstrings (Nemocas/AbstractAlgebra.jl#1431)

* Fix `PosInf` docstring (Nemocas/Nemo.jl#1528)

* Adapt doctests to new printing for maps Nemocas/AbstractAlgebra.jl#1424
fieker pushed a commit to oscar-system/Oscar.jl that referenced this pull request Sep 29, 2023
* Bump compats

* Remove functions moved to Nemo (Nemocas/Nemo.jl#1519)

* Fix `ZZ` printing (Nemocas/Nemo.jl#1506)

* Fix `identity_map` docstrings (Nemocas/AbstractAlgebra.jl#1431)

* Fix `PosInf` docstring (Nemocas/Nemo.jl#1528)

* Adapt doctests to new printing for maps Nemocas/AbstractAlgebra.jl#1424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants