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

deprecate names! #1986

Merged
merged 5 commits into from
Oct 17, 2019
Merged

deprecate names! #1986

merged 5 commits into from
Oct 17, 2019

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Oct 14, 2019

Fixes #1943.

@nalimilan after this is the last PR (apart from some already open ones) that I think is needed before 0.20 release.

src/abstractdataframe/abstractdataframe.jl Outdated Show resolved Hide resolved
src/abstractdataframe/abstractdataframe.jl Outdated Show resolved Hide resolved
@@ -38,6 +38,36 @@ const ≇ = !isequal
end
end

@testset "additional rename! tests" begin
Random.seed!(123)
for i in 1:1000
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this brute-force approach? Can't you just choose a set of values that cover all possible cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

It takes 0.1 second to run these 1000 tests. I add this because I was not sure if we cover all possible cases manually (the code for rename! in #1974 is tricky, so I prefer to be on a safe side).

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, but are you sure that with 1000 iterations we cover all cases? :-)

Anyway, please add a comment explaining a bit why we do this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for the docs fixes - a keen eye as always 😄.

I have added a note in the test. In general I am convinced that 1000 should cover all cases (I have chosen column count - 8 and names set so that with high probability all cases are covered). But I am not sure 😢, if I were sure I would not write a randomized test.

In general we want to be sure that cyclical renames like :X=>:Y, :Y=>:Z, :Z=>:X for various cycle lengths are processed correctly and also that non cyclical renames like :X=>:Y, :Z=>:X are processed correctly also when they happen in combination and in the presence of other columns that are not renamed and in two subcategories: a) the proposed renaming scheme is valid and b) the proposed renaming scheme is invalid (so as you see there are really many possible combinations of cases and it is really hard to make sure that you cover all of them if you do not generate the tests randomly; for sure the existing tests have not covered all the possibilities).

bkamins and others added 2 commits October 15, 2019 10:02
bkamins and others added 2 commits October 15, 2019 11:02
Co-Authored-By: Milan Bouchet-Valat <nalimilan@club.fr>
@bkamins
Copy link
Member Author

bkamins commented Oct 16, 2019

CI fails due to coverage. Otherwise this should be good for a final review. Thank you.

@bkamins bkamins merged commit 9b30a99 into JuliaData:master Oct 17, 2019
@bkamins bkamins deleted the improve_rename branch October 17, 2019 21:34
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.

merge names! into rename!`
2 participants