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
tests: fix B015 #682
tests: fix B015 #682
Conversation
B015 Pointless comparison. This comparison does nothing but wastes CPU instructions. Remove it.
Although technically the way these were caught was by "pointless comparisons," they're not pointless—they're attempts at assertions that failed to get the word "asset" (or somehow lost it). Similarly, before I added the rule that "the truth value of an array is ambiguous," there had been assertions that always returned true, even if the arrays on both sides of the This automated check has revealed two failing tests. Both contain a trivial thing to fix: the string representation of a floating point number has a trailing This test from way back in the "0018" era would have caught this introduced error, but it was missing the word I'll fix this tomorrow when I get to my computer, unless @ianna gets to it first. (This is in the new multi-line JSON handling. If only one full JSON document is observed, it should not be considered the first in a series, but the entirety of that single document.) |
I'm using my fork, so |
I've actually had a discussion with the author of this check on special cases, by the way. There is a very rare, special case where you have to use a |
I had been thinking that this was a bug introduced by PR #543, but I was wrong. It wasn't reading a single JSON document as though it were a JSONs stream, it was writing a single JSON document with one level too deep nesting. I did some forensics on it: there was a time when the When this change was put in, I must have been testing the string output because that's easy to write a test around. I would have been assuming that the file version was okay because there were tests of JSON input and output "since forever." So I was explicitly relying on the test that apparently didn't have the word |
It's green. :) |
B015 Pointless comparison. This comparison does nothing but wastes CPU instructions. Remove it.
This is a followup to #681; this time fixing a warning from one of my favorite flake8 extensions, bugbear. The warning (above) tells you to remove pointless comparisons, but 95% of the time, such as all the cases here, they tend to be missed asserts in PyTest.