underscore.py icon indicating copy to clipboard operation
underscore.py copied to clipboard

where() appears to be broken

Open markerikson opened this issue 8 years ago • 0 comments

The current tests for _.where() only test with a single key:value pair to filter by. I'm seeing behavior that looks like the function does not work properly if there are multiple key:value pairs. Specifically, it seems like the code will actually return True if the very first pair checked matches, rather than waiting for ALL of them to match.

Looking at the code, I believe the "return True" line merely needs to be unindented to be outside the "for key, value" loop, thus only returning successfully if all pairs match.

markerikson avatar Oct 02 '15 20:10 markerikson