I'm using mock with py.test for unittests.
One function under test looks like the one below:
def convert(rows):
rows = (preprocess(r) for r in rows)
return batch_process(True, rows)
In the test, I would mock preprocess and batch_process. For preprocess, I use side_effect to configure multiple return values, one for each of the rows.
How do I assert that the second argument passed to batch_process is a generator expression of preprocessed rows?
Aucun commentaire:
Enregistrer un commentaire