Le 11/10/13 10:57 PM, Nick Coghlan a écrit : > >
On 11 Nov 2013 02:12, "Antoine Pitrou" <firstname.lastname@example.org
mailto:email@example.com> wrote: >
Le 10/11/2013 15:48, Nick Coghlan a écrit :
It would make more sense to just bake py.test style rich assertions into the language in some way and let people write:
def sum(iterable): # implementation of sum assert sum() == 0 assert sum([1, 2, 3]) == 6
This has the same problem as doctests: it works well for trivial tests like the above, but will be difficult to scale towards more complicated testing.
Yeah, part of my point was actually that module level assertions allow this kind of thing today, and there are good reasons people don't do it in practice.
Interesting... what if we could mark a block of tests like this :
# implementation of sum
assert sum() == 0
assert sum([1, 2, 3]) == 6
... ..more complicated testing here...