[Python-ideas] remove coupling between unittest and assertions

Gregory Salvan apieum at gmail.com
Fri Nov 15 08:55:29 CET 2013


Hi,
I would seperate unittest from its assertions.
I suggest to create the module "assertions" in stdlib.

- it will not change unittest api
- it improves decoupling and SOC so other testing library will be able to
share a common base code avoiding duplication
- it would be great to write guard clauses with more expressive error
message like that for example:
from assertions import assert_in

def my_function(*args, **kwargs):
    assert_in(''option", kwargs)
    ...

This last point merits more reflexion since "assert" is removed when python
compiles in optimize mode. A such mecanism can be added further in
assertions lib.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131115/e82cceca/attachment.html>


More information about the Python-ideas mailing list