-
Notifications
You must be signed in to change notification settings - Fork 64
Ángel Sanz edited this page Apr 3, 2016
·
4 revisions
The code of your tests needs to go somewhere. In some testing tools, you typically write the description of your tests as method names and their code as the body of the method. In mamba, you write the descriptions as strings, and the code as the body of a with
statement. You can view this as a way to emulate multiline lambdas.
In the past, mamba used actual context managers for processing the code in your tests. This is no longer the case, but the convenient syntax has been kept. mamba now works by reading that code, parsing its AST and transforming it to the unittest
-like "class + methods" test tree. You can learn more about the transformation by looking at the source and by using mamba_xrays
.