mercredi 8 juillet 2015

How to write time dependent tests Python

Suppose I have a function:

def third_day_from_now():
    return datetime.date.today() + datetime.timedelta(days=3)

I want to write tests for this function ? I know that If today is 25th then the function should return 28. Is there a way somehow I can force the datetime object to return current date as 25 ?

Aucun commentaire:

Enregistrer un commentaire