You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use assertIsInstance and assertNotIsInstance unittest methods #2700
Several tests in both search_tests_common.py and seq_tests_common.py are not subclasses of unittest.TestCase, and would need to be restructured to leverage the unittest methods. As it's common code for a number of tests, I'm not comfortable making large changes to those modules given my recency to the project. Is there any guidance on how to proceed from here?
Activity
Implements assert changes as detailed in biopython #2700
peterjc commentedon Mar 3, 2020
Almost all of the above were fixed with #2776,
Probably can be just
self.assertIsInstance(hits, list)as the default failure message is pretty good?Also I found a few more with a different search:
deekerno commentedon Mar 3, 2020
Oops, I thought I fixed
test_PDB_KDTree. My apologies. I can do that one as well as fixing the other ones in that other search that you mentioned.peterjc commentedon Mar 3, 2020
That'd be great - thanks for tackling this rather tedious bit of code cleanup 🥇
MarkusPiotrowski commentedon Mar 3, 2020
There is a
flake8plugin calledflake8-assertivewhich list a number ofassert...issues in ourtestsfolder:The error codes include several similar issues each, e.g. A500 can also be 'prefer assert Equal() for '==' comparisons' etc. etc.
deekerno commentedon Mar 3, 2020
Several tests in both
search_tests_common.pyandseq_tests_common.pyare not subclasses ofunittest.TestCase, and would need to be restructured to leverage theunittestmethods. As it's common code for a number of tests, I'm not comfortable making large changes to those modules given my recency to the project. Is there any guidance on how to proceed from here?peterjc commentedon Mar 3, 2020
Sorry @adcrn, I forgot that - yes, this only applies to the tests already using
unittest.Using
flake8-assertivewill be more reliable than grep 👍Use self.assertIsInstance in tests
peterjc commentedon May 9, 2020
My tiny pull request #2873 should close this issue.
Use self.assertIsInstance in tests