-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: test explicit copy keyword with CoW enabled #50536
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
Conversation
|
||
if using_copy_on_write: | ||
if (using_copy_on_write and copy is not True) or copy is 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.
The current PR experiments with combining testing the copy=True/False/None
keyword in those tests that we have been adding to test the CoW behaviour of those methods.
Combining it would give the least duplication, but, I have to say that the if
expressions are getting quite complicated and hard to follow ..
For example here if (using_copy_on_write and copy is not True) or copy is False
and below if using_copy_on_write or copy is not False
and if using_copy_on_write and copy is not True
, all slightly different.
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.
Yikes this got complicated :) Do you think moving these checks into separate functions makes it easier to read?
That depends a bit on what exactly we would be testing. Maybe it is enough to restrict ourselves to just the method call, and have an additional test like this (for this example in addition to
In that case it would probably keep it generally simpler (you still have the complex So yes, if we think the above test is sufficient for parametrizing with |
@phofl thoughts? Shall I do the separate test? |
I'll take a close look later today |
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.
So just a quick question: Do you think it's possible to test the copy=True case in one test and parametrising over all functions? I guess it would be sufficient that the objects don't share memory here without checking the actual result? I think this would be easier to read.
Just asking if you think this is feasible
Yeah, my example test above (#50536 (comment)) only does the memory check, so indeed we could parametrize that for several methods (to the extent they keep the same column names / structure, to easily refer to the column to check) |
Looks good, can we add swapaxes doing a no-op? |
xref #50535, part about that we need to test the
copy
keyword as well in those CoW tests.