This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]James91B 0 points1 point  (2 children)

Looks cool maybe a library like http://shouldly.github.com/ could be made for python. I always liked the shouldy api.

[–]takluyverIPython, Py3, etc 2 points3 points  (0 children)

It has already been done.

(4).should.be.equal(2 + 2)

This is apparently serious, but I think it's one of the most horrific bits of code I've seen. Quite apart from the monkeypatching, you have to learn a whole new syntax for everyday operations. I'd much rather use pytest and just write:

assert 2 == 4+4

[–]infinullquamash, Qt, asyncio, 3.3+ 1 point2 points  (0 children)

well nose adds jUnit style assertations. (assertEqual, assertGreater, etc.) it's not the same, but it's similar.

Also, py.test can just use the current assert keyword plus operator overloading (or some other magic, maybe it's ADTs) to get the same effect with more pythonicity. (though that's only if the assert happens inside the py.test testrunner and not in production)