4 ms·
I’m surprised the approach of https://github.com/sconover/wrong https://github.com/sconover/wrong never caught on where you just write assert { x == y } and it
by hombre_fatal 6y ago
I’m surprised the approach of https://github.com/sconover/wrong https://github.com/sconover/wrong never caught on where you just write assert { x == y } and it inspects the values you’re comparing and the methods you’re using to generate the appropriate error messages and, say, a diff of where two arrays diverge.
- nerdponx 6y agoThis is exactly what the Pytest framework in Python does. It's very, very convenient.
- srbaker 6y agoI am a fan of pytest, and mightn't have thought to make the same thing in Python land.
- aYsY4dDQ2NrcNzA 6y agoAnd in fact, pytest gives you hooks for these various kinds of value comparisons so that you can generate any error message that you want.
- srbaker 6y agoA generic assert that fails on AssertionFailedException, and errors on all other exceptions is the ideal.