Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidying __init__ #261

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Blackification
  • Loading branch information
pepoluan committed Jan 17, 2023
commit 09b89e112be96a4b2c3f6319a65845b464a10bdf
2 changes: 1 addition & 1 deletion aiosmtpd/lmtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class LMTP(SMTP):
show_smtp_greeting: bool = False

@syntax('LHLO hostname')
@syntax("LHLO hostname")
async def smtp_LHLO(self, arg: str) -> None:
"""The LMTP greeting, used instead of HELO/EHLO."""
await super().smtp_EHLO(arg)
Expand Down
2 changes: 1 addition & 1 deletion aiosmtpd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _parser() -> ArgumentParser:
action="count",
help=(
"Increase debugging output. Every ``-d`` increases debugging level by one."
)
),
)
parser.add_argument(
"-l",
Expand Down
6 changes: 3 additions & 3 deletions aiosmtpd/tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class TestMessage:
bytearray(),
"",
],
ids=["bytes", "bytearray", "str"]
ids=["bytes", "bytearray", "str"],
)
def test_prepare_message(self, temp_event_loop, content):
sess_ = ServerSession(temp_event_loop)
Expand All @@ -460,7 +460,7 @@ def test_prepare_message(self, temp_event_loop, content):
enve_.content = content
msg = handler.prepare_message(sess_, enve_)
assert isinstance(msg, Em_Message)
assert msg.keys() == ['X-Peer', 'X-MailFrom', 'X-RcptTo']
assert msg.keys() == ["X-Peer", "X-MailFrom", "X-RcptTo"]
assert msg.get_payload() == ""

@pytest.mark.parametrize(
Expand All @@ -471,7 +471,7 @@ def test_prepare_message(self, temp_event_loop, content):
({}, r"Expected str or bytes, got <class 'dict'>"),
((), r"Expected str or bytes, got <class 'tuple'>"),
],
ids=("None", "List", "Dict", "Tuple")
ids=("None", "List", "Dict", "Tuple"),
)
def test_prepare_message_err(self, temp_event_loop, content, expectre):
sess_ = ServerSession(temp_event_loop)
Expand Down
8 changes: 2 additions & 6 deletions aiosmtpd/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,7 @@ def test_unixsocket(self, safe_socket_dir, autostop_loop, runner):
with pytest.raises((socket.timeout, ConnectionError)):
assert_smtp_socket(cont)

@pytest.mark.filterwarnings(
"ignore::pytest.PytestUnraisableExceptionWarning"
)
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
def test_inet_loopstop(self, autostop_loop, runner):
"""
Verify behavior when the loop is stopped before controller is stopped
Expand Down Expand Up @@ -489,9 +487,7 @@ def test_inet_loopstop(self, autostop_loop, runner):
with pytest.raises((socket.timeout, ConnectionError)):
SMTPClient(cont.hostname, cont.port, timeout=0.1)

@pytest.mark.filterwarnings(
"ignore::pytest.PytestUnraisableExceptionWarning"
)
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
def test_inet_contstop(self, temp_event_loop, runner):
"""
Verify behavior when the controller is stopped before loop is stopped
Expand Down
11 changes: 3 additions & 8 deletions aiosmtpd/tests/test_smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ def authenticator_peeker_controller(

@pytest.fixture
def decoding_authnotls_controller(
get_handler: Callable,
get_controller: Callable[..., Controller]
get_handler: Callable, get_controller: Callable[..., Controller]
) -> Generator[Controller, None, None]:
handler = get_handler()
controller = get_controller(
Expand Down Expand Up @@ -996,9 +995,7 @@ def test_auth_loginteract_warning(self, client):
@pytest.mark.usefixtures("auth_peeker_controller")
class TestAuthMechanisms(_CommonMethods):
@pytest.fixture
def do_auth_plain1(
self, client
) -> Callable[[str], Tuple[int, bytes]]:
def do_auth_plain1(self, client) -> Callable[[str], Tuple[int, bytes]]:
self._ehlo(client)

def do(param: str) -> Tuple[int, bytes]:
Expand All @@ -1008,9 +1005,7 @@ def do(param: str) -> Tuple[int, bytes]:
return do

@pytest.fixture
def do_auth_login3(
self, client
) -> Callable[[str], Tuple[int, bytes]]:
def do_auth_login3(self, client) -> Callable[[str], Tuple[int, bytes]]:
self._ehlo(client)
resp = client.docmd("AUTH LOGIN")
assert resp == S.S334_AUTH_USERNAME
Expand Down