Stop Using datetime.now!

Practical Dependency Injection in Python

One of my favorite job interview questions is this:

Write a function that returns tomorrow’s date

This looks innocent enough for someone to suggest this as a solution:

This will work, but there is a followup question:

How would you test this function?

Before you move on…. take a second to think about your answer.

Photo by Pedro Figueras

Keep reading this article on my personal blog >>>

Originally published at https://hakibenita.com on June 1, 2020.

Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com