I'm trying to check a certain list against very a very specific set of rules. In this particular example, I have a list of exit codes and I want to check if the test failed. The test fails if even one of the exit codes isn't 0.
My current implementation:
for exit_code in result_list:
if exit_code is not 0:
raise TestFailed
Question: is it possible to cram the first two lines into one? Is it preferable to do so?
Aucun commentaire:
Enregistrer un commentaire