underscore.py
underscore.py copied to clipboard
where() appears to be broken
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.