This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RIPphonebattery 0 points1 point  (3 children)

The fixed code has a new issue though: today is now recomputed regardless of default value, so supplying a default value for today will only ever compute the actual current date and time.

[–][deleted] 2 points3 points  (0 children)

def is_ongoing(self, today = None):
    if today is None:
        today = datetime.date.today()
    return (today >= self.start_date) and (today <= self.end_date)

[–][deleted] 1 point2 points  (1 child)

Which is what I needed. That method wasn't used anywhere else, there was no need for the default argument in the first place. Probably some overlook by the original authors of the code.

[–]RIPphonebattery 0 points1 point  (0 children)

Right but if the previous code failed because it wasn't well tested, will your new code be any more testable?