I'd like that every assertion test in a TestCase is actually tested, even if the first one fails. In my situation, all the assertions are of the same nature.
Actually I have something that evaluates formulas written as Python objects (figure it as formulas written as strings to be eval
'd). I'd like to do something like:
class MyTest(TestCase):
def test_something(self):
for id in ids:
for expression in get_formulas(id):
for variable in extract_variables(expression):
self.assertIn(variable, list_of_all_variables)
=> I want to see printed all of the variable
s that are not in the list_of_all_variables
!
This is necessary for me to review all my so-called formulas and be able to correct errors.
Some more context:
I'm having a variable number of tests to perform (depending on a list of IDs written in a versioned data file) in one app.
To have a variable number of TestCase instances, I did write a base class (mixin), then build on-the-fly classes with the use of 3-args type
function (that is creating classes).
This way, I have n
tests, corresponding to the n
different ids. It's a first step, but what I want is that each and every assertion in those tests gets tested and the corresponding assertion errors get printed.