Update quotes in use-cases example

This commit is contained in:
Roman Mogylatov 2021-09-30 19:01:31 -04:00
parent b64c9b7a05
commit 8bea62eeee
3 changed files with 8 additions and 8 deletions

View File

@ -6,12 +6,12 @@ from .containers import UseCases, Adapters, TestAdapters
def main(environment: str, email: str) -> None: def main(environment: str, email: str) -> None:
if environment == 'prod': if environment == "prod":
adapters = Adapters() adapters = Adapters()
elif environment == 'test': elif environment == "test":
adapters = TestAdapters() adapters = TestAdapters()
else: else:
raise RuntimeError('Unknown environment') raise RuntimeError("Unknown environment")
use_cases = UseCases(adapters=adapters) use_cases = UseCases(adapters=adapters)
@ -19,5 +19,5 @@ def main(environment: str, email: str) -> None:
use_case.execute(email) use_case.execute(email)
if __name__ == '__main__': if __name__ == "__main__":
main(*sys.argv[1:]) main(*sys.argv[1:])

View File

@ -13,10 +13,10 @@ class EmailSender(metaclass=abc.ABCMeta):
class SmtpEmailSender: class SmtpEmailSender:
def send(self, to: str, body: str) -> None: def send(self, to: str, body: str) -> None:
print(f'Sending an email to {to} over SMTP, body="{body}"') print(f"Sending an email to {to} over SMTP, body=\"{body}\"")
class EchoEmailSender: class EchoEmailSender:
def send(self, to: str, body: str) -> None: def send(self, to: str, body: str) -> None:
print(f'Fake sending an email to {to}, body="{body}"') print(f"Fake sending an email to {to}, body=\"{body}\"")

View File

@ -18,5 +18,5 @@ class SignupUseCase:
self.email_sender = email_sender self.email_sender = email_sender
def execute(self, email: str) -> None: def execute(self, email: str) -> None:
print(f'Sign up user {email}') print(f"Sign up user {email}")
self.email_sender.send(email, f'Welcome, {email}') self.email_sender.send(email, f"Welcome, {email}")