[Python-ideas] where statement in Pyret

Antoine Pitrou solipsis at pitrou.net
Sun Nov 10 17:12:19 CET 2013


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.

unittest-like structuration is really what works best for most testing 
situations, IMO. Alternative testing schemes for "easier" or "more 
intuitive" testing have generally failed as general-purpose tools.

Regards

Antoine.




More information about the Python-ideas mailing list