Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions patterns/dft/constructor_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class ProductionCodeTimeProvider(object):
Production code version of the time provider (just a wrapper for formatting
datetime for this example).
"""

def now(self):
@staticmethod
def now():
current_time = datetime.datetime.now()
current_time_formatted = "{}:{}".format(current_time.hour, current_time.minute)
return current_time_formatted
Expand All @@ -47,7 +47,7 @@ class MidnightTimeProvider(object):
"""
Class implemented as hard-coded stub (in contrast to configurable stub).
"""

def now(self):
@staticmethod
def now():
current_time_is_always_midnight = "24:01"
return current_time_is_always_midnight