Practice · 1 of 2
Freeze the Clock
CHALLENGE
Difficulty: intermediate+25 XP
Implement greeting(name, now=None) returning 'Good morning, <name>!' for hours 5-11, 'Good afternoon' for 12-17, 'Good evening' otherwise. now is a datetime; default to datetime.now(). Then write TestGreeting that patches the clock (patch the module-level datetime or inject fixed datetimes via now=) to test all three bands. Assign to SUITE_TEST.
Press Submit to check your solution.
Back to lesson: Practice: Mock Drills