-
Notifications
You must be signed in to change notification settings - Fork 3
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
conformance: types can't imply finiteness #41
Conversation
Codecov Report
@@ Coverage Diff @@
## main #41 +/- ##
==========================================
- Coverage 96.39% 96.36% -0.04%
==========================================
Files 4 3 -1
Lines 111 110 -1
==========================================
- Hits 107 106 -1
Misses 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
test/conformance_test.jl
Outdated
else | ||
@test isfinite(G) == false |
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 think this testset hasn't been finished:
elseif IS isa Base.IsInfinite
...
else
@test IS isa Base.SizeUnknown
@test_throws ArgumentError isfinite(G)
end
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.
That also makes no sense. IS
is derived only from the type of G
. But there are types which have both finite and infinite instances. So isfinite
will not throw an exception in general.
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.
then surround @test_throws
by try
statement and test first whether isfinite
returns a Bool
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've split this PR into three; this original PR retains the iterator test changes. I've now adjusted them along the lines of what you wrote, but in a way that ensures the tests for finite groups are performed solely based on whether isfinite(G) == true
, regardless of what Base.IteratorSize(typeof(G))
gives.
I can follow the first part, but then the fix is not to delete the test, but replace it with @test deepcopy(one(G)) !== one(G) The second part I can't really follow though. Objects that can be deepcopied are precisely those which can be made distinct by... Giving it a second look, probably the the guard function should be defined in a separate file in tests, there is no need for it in the package itself. |
The relation you claim between isbits/isbitstype on the one hand and deepcopying on the other simply does not hold in reality: there are struct types which are not bits types but for which deepcopy nevertheless returns identical objects. Eg in Oscar, groups elements are structs which are not bits types because they contain a parent pointer. But deepcopy preserves the parent, hence === does not distinguish the original object from its deepcopy |
To give a concrete example:
All in all, it is also is not clear to me what this check on |
Yes I know about GroupsCore._is_deepcopiable(::GAPGroupElement) = false ?
The purpose is to make sure that if a group element is deepcopiable then I like the example ;) though it seems to be a corner case, since
|
668134f
to
8747c92
Compare
I've split this PR into three parts, so that they can be discussed and possibly merged independently. Let's move the discussion on deepcopy to PR #43. Should have done that from the start :-) |
else | ||
@test IS isa Base.SizeUnknown | ||
try | ||
isfiniteG = isfinite(G) |
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.
ah this should also verify that isfiniteG
is a Bool
. Will add.
Finitely presented groups can be both finite and infinite, so it is not practical to require that the type of a group must already imply whether instances of the type are finite or infinite. Yet the conformance tests were doing exactly that.
8747c92
to
1d9bd0b
Compare
@kalmarek Can we get a release containing this PR? We would like to use the conformance tests for generalized Weyl groups in Oscar, but are currently unable to do so as our groups can both be finite and infinite. This PR should fix this. |
@lgoettgens sure; Since you've implemented a Group interface what is your opinion on #44 ? Can you show a link to your implementation? |
Finitely presented groups can be both finite and infinite, so it is not practical to require that the type of a group must already imply whether instances of the type are finite or infinite. Yet the conformance tests were doing exactly that.