def test_at_dusk(self, next, at): handler = MagicMock() location = Astral()[LOCATION] timers.at_dusk(handler) next.assert_called_once_with(location.dusk(local=False).timetz()) at.assert_called_once_with(next.return_value, handler) handler.assert_not_called()
def at_dusk(handler): location = Astral()[LOCATION] dusk = next(location.dusk(local=False).timetz()) return at(dusk, handler)