-
Notifications
You must be signed in to change notification settings - Fork 36
Make subset preserve varname ordering in varinfo #832
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -729,6 +729,16 @@ end | |
# Values should be the same. | ||
@test [varinfo_merged[vn] for vn in vns] == [varinfo[vn] for vn in vns] | ||
end | ||
|
||
@testset "$(convert(Vector{VarName}, vns_subset)) order" for vns_subset in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you feel confident that all the methods we have for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As in, is there more to be tested here or do we feel confident about this converage? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Confident, nope. Hopeful at best. I think this PR makes the situation marginally better though, in that it is a bit harder to create VarInfos with empty Metadatas using I was about to say that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, definitively think this PR is making the situation better:) I was mainly trying to elude to whether we should add a few more test cases here / add an "empty" varinfo to be tested somewhere else. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened an issue about it here: #839 |
||
vns_supported | ||
varinfo_subset = subset(varinfo, vns_subset) | ||
vns_subset_reversed = reverse(vns_subset) | ||
varinfo_subset_reversed = subset(varinfo, vns_subset_reversed) | ||
@test varinfo_subset[:] == varinfo_subset_reversed[:] | ||
ground_truth = [varinfo[vn] for vn in vns_subset] | ||
@test varinfo_subset[:] == ground_truth | ||
end | ||
end | ||
|
||
# For certain varinfos we should have errors. | ||
|
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 is fine. But maybe we could add some
isempty
check where we usesubset
?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 that would be preferable, but I don't know how to do it in a type stable manner. Specifically, I would like to implement it so that if we get a TypedVarInfo where for some symbol
:dada
the correspondingMetadata
object is empty, we would drop:dada
from theNamedTuple
. But that means that the type of the return value depends on the value of the input (and not just the type of the input), since the keys of aNamedTuple
are a part of its type.