-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Convert use of assert_/assert to specialized asserts in tests #6175
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
Comments
anyway just to fix |
Using |
and you learn something new every day...ok! |
On a good day, I do. |
Similar problem from
which gives an uniformative
@bwignall, care to take another step? We could use a more informative |
I will chip away at this more, @y-p. I was thinking of continuing on the assert_(x == y) theme, then circling back to other forms. |
BUG: #6175 Got rid of assert_ statements in test_algos.py
Just to point out, some of these aren't supported in 2.6 e.g. assertIsInstance, should we worry about that ? travis hasn't been able to test on 2.6 for a good while... 👍 on changing them all. Note: they are backported in unittest2 - so we could import unittest2 as unittest in util/testing for py < 27?... |
@hayd what do u mean |
@bwignall leave this issue open? |
@hayd: tm.TestCase has versions of these, which should be API-compatible with the Python 2.7+ functions. @jreback: I just went through the assertions again, and with the latest (#6580) PR, it looks like all of the straightforward changes have been made. There are still some assert_(...) statements, but those could all be changed to assertTrue(...) or assertFalse(...) at this point, if desired. |
@bwignall that's for all the effort in this! |
Work on pandas-dev#6175. Changes instances of assert_(a [not] in b) to specialized assert[Not]In(a,b).
Work on pandas-dev#6175. Changes instances of assert_(a is [not] None) to specialized assertIs[Not]None(a).
Work on pandas-dev#6175. This is the third (and final) "half" of the work started in pandas-dev#6368.
Work on pandas-dev#6175. Changes instances of assert_(a is [not] b) to specialized assertIs[Not](a, b).
Work on pandas-dev#6175. Changes instances of assert_(a [not] in b) to specialized assert[Not]In(a, b).
Work on pandas-dev#6175. Changes instances of assert_([not] isinstance(a,b)) to specialized assert[Not]IsInstance(a, b).
Work on pandas-dev#6175. Change superclass of tests/test_compat, to use tm.TestCase
Finishes pandas-dev#6175, to the extent that everything remaining can be mapped to assertTrue or assertFalse, unless larger refactorings are desired.
An example of an exception that uses
assert_
:note the line:
if this had been
assertEqual
, we'd have seen what the value wereand been able to debug easier (now fixed). (though, It should be obvious why that test is unreliable).
There are lots of these across the tests.
If someone steps up to do this, do a little bit at a time.
a PR that touches 200 tests will defy review and be stuck forever
in PR limbo.
The text was updated successfully, but these errors were encountered: