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.

Image for post
Image for post
Photo by Pedro Figueras

Keep reading this article on my personal blog >>>

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store