I have a function iterating over a directory and returning pathlib.PosixPath objects for each file in that directory. I would like to write a test for this function. My only idea is to use mocking but I have no clue how to go about that.
def get_templates(self):
p = Path(self.root, self.templates_dir)
return [file for file in p.iterdir() if file.is_file()]
Aucun commentaire:
Enregistrer un commentaire