I'm doing a unit testing, I'm checking fields in two databases collections so during it I have to do a multi if conditions like this:
for doc1,doc2 in itertools.izip(docs1, docs2):
if ... :
if ... :
response = 'Error'
else:
response = 'OK'
else... :
if ... :
response = 'Error'
else:
response = 'OK'
if ... :
if ... :
response = 'Error'
else ... :
response = 'OK'
else ... :
if ... :
response = 'Error'
else ... :
response = 'OK'
so I want to assert a response if the error happened in one of this ifs, to give an answer like this: self.assert400(response, message="Bad request, empty body.")
and when the whole process is okay to give an Ok response.
So what to achieve this?
I thought to create an if condition in the end of it but that wouldn't stop the for loop?Please help me?
Aucun commentaire:
Enregistrer un commentaire