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.
Originally published at https://hakibenita.com on June 1, 2020.