-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Remove return values for asserts #25462
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
Unless they are context managers.
Looks like a slew of test changes as a result of code like If you test locally first should make it easier to find up front |
OK am hoping to fix the tests shortly. |
assert either raises or doesn't. If it doesn't tm.assert_* returns None, and there's no need to assert XXX is None.
Codecov Report
@@ Coverage Diff @@
## master #25462 +/- ##
===========================================
- Coverage 91.74% 41.72% -50.02%
===========================================
Files 173 173
Lines 52923 52922 -1
===========================================
- Hits 48554 22084 -26470
- Misses 4369 30838 +26469
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25462 +/- ##
==========================================
- Coverage 91.98% 91.98% -0.01%
==========================================
Files 175 175
Lines 52374 52373 -1
==========================================
- Hits 48178 48173 -5
- Misses 4196 4200 +4
Continue to review full report at Codecov.
|
@samuelsinayoko : This looks much better! I still see a handful of |
done in 60ec5ee |
@samuelsinayoko : I think you only removed the ones in |
Ha sorry! Will update the PR today.
…Sent from my iPhone
On 4 Mar 2019, at 08:48, gfyoung ***@***.***> wrote:
@samuelsinayoko : I think you only removed the ones in assert_almost_equal. There are still two in assert_series_equal. Were you able to remove those?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
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.
lgtm @jreback
@@ -1009,7 +1009,7 @@ def test_fromDict(self): | |||
data = {'a': 0, 'b': 1, 'c': 2, 'd': 3} | |||
|
|||
series = Series(data) | |||
assert tm.is_sorted(series.index) | |||
tm.is_sorted(series.index) |
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.
can you rename this routine to tm.assert_is_sorted
pandas/util/testing.py
Outdated
|
||
elif (is_extension_array_dtype(left) and not is_categorical_dtype(left) and | ||
is_extension_array_dtype(right) and not is_categorical_dtype(right)): | ||
return assert_extension_array_equal(left.array, right.array) | ||
assert_extension_array_equal(left.array, right.array) | ||
return |
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.
same don't need a return
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 tried this earlier but some of the tests failed so I added the returns back.
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.
See 091a00e (this was in response to an earlier PR comment)
can you merge master and update |
OK I'll give this another go.
…On Tue, 26 Mar 2019 at 11:52, Jeff Reback ***@***.***> wrote:
@samuelsinayoko <https://github.com/samuelsinayoko> you may need to fix
some tests that are actually asserting the result of this assert, but I
want to remove the return values
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25462 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQuwvoIm4H69yV_3a7pOHtrxIzmje36Rks5vagntgaJpZM4bVN-a>
.
--
*Sam Sinayoko* | Data Scientist
*BMLL Technologies Ltd.*
10th Floor – Portland House
Bressenden Place
London
SW1E 5RS
+44(0)20 3828 9020
|
can you merge master and update |
Apologies, haven't found the time to come back to this as work's been crazy
for the past couple of weeks but will update the PR over the weekend.
…On Fri, 5 Apr 2019 at 01:51, Jeff Reback ***@***.***> wrote:
can you merge master and update
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25462 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQuwvuUm4RYJbZPrU-0idZAykUR1dzw5ks5vdp4SgaJpZM4bVN-a>
.
--
*Sam Sinayoko* | Data Scientist
*BMLL Technologies Ltd.*
10th Floor – Portland House
Bressenden Place
London
SW1E 5RS
+44(0)20 3828 9020
|
pandas/util/testing.py
Outdated
|
||
elif (is_extension_array_dtype(left) and not is_categorical_dtype(left) and | ||
is_extension_array_dtype(right) and not is_categorical_dtype(right)): | ||
return assert_extension_array_equal(left.array, right.array) | ||
assert_extension_array_equal(left.array, right.array) | ||
return |
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.
this just returns None which is the same as if you leave the return out, pls remove
can you merge master |
Can you merge and fix up conflicts with master? I think this will be a precursor to #26234 |
Sure. Will do tonight.
…Sent from my iPhone
On 30 Apr 2019, at 02:45, William Ayd ***@***.***> wrote:
Can you merge and fix up conflicts with master? I think this will be a precursor to #26234
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
not exactly sure why, but this surfaced an error in our tests pushed a patch, let's see |
Looks like a test failure in pandas/tests/io/parser/test_textreader.py which is inadvertently expecting a return value from one of the assert functions; if you can take a look |
Will do.
…On Wed, 1 May 2019 at 15:06, William Ayd ***@***.***> wrote:
Looks like a test failure in pandas/tests/io/parser/test_textreader.py
which is inadvertently expecting a return value from one of the assert
functions; if you can take a look
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25462 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEF3BPWUZSFDCWFM75YBYH3PTGPWNANCNFSM4G2U36NA>
.
--
*Sam Sinayoko* | Data Scientist
*BMLL Technologies Ltd.*
10th Floor – Portland House
Bressenden Place
London
SW1E 5RS
+44(0)20 3828 9020
|
i pushed again, let's see |
@WillAyd I think we would get a lot of mileage out of typing these assert_* functions, can you create an issue |
thanks for the patch @samuelsinayoko |
Unless they are context managers.
git diff upstream/master -u -- "*.py" | flake8 --diff