Skip to content

Commit 3668450

Browse files
committed
Fix formatting
1 parent 868d72f commit 3668450

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

src/aleph/sdk/client/authenticated_http.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from aleph_message.status import MessageStatus
3636

3737
from ..conf import settings
38-
from ..exceptions import BroadcastError, InvalidMessageError, InsufficientFundsError
38+
from ..exceptions import BroadcastError, InsufficientFundsError, InvalidMessageError
3939
from ..types import Account, StorageEnum
4040
from ..utils import extended_json_encoder
4141
from .abstract import AuthenticatedAlephClient
@@ -691,7 +691,9 @@ async def submit(
691691
allow_inlining=allow_inlining,
692692
storage_engine=storage_engine,
693693
)
694-
response, message_status = await self._broadcast(message=message, sync=sync, raise_on_rejected=raise_on_rejected)
694+
response, message_status = await self._broadcast(
695+
message=message, sync=sync, raise_on_rejected=raise_on_rejected
696+
)
695697
return message, message_status, response
696698

697699
async def _storage_push_file_with_message(

tests/unit/conftest.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,27 @@ def get(self, *_args, **_kwargs):
223223

224224

225225
@pytest.fixture
226-
def mock_session_with_rejected_message(ethereum_account, rejected_message) -> AuthenticatedAlephHttpClient:
226+
def mock_session_with_rejected_message(
227+
ethereum_account, rejected_message
228+
) -> AuthenticatedAlephHttpClient:
227229
class MockHttpSession(AsyncMock):
228230
def get(self, *_args, **_kwargs):
229231
return make_custom_mock_response(rejected_message)
230232

231233
def post(self, *_args, **_kwargs):
232-
return make_custom_mock_response({
233-
"message_status": "rejected",
234-
"publication_status": {"status": "success", "failed": []},
235-
}, status=422)
234+
return make_custom_mock_response(
235+
{
236+
"message_status": "rejected",
237+
"publication_status": {"status": "success", "failed": []},
238+
},
239+
status=422,
240+
)
236241

237242
http_session = MockHttpSession()
238243

239-
client = AuthenticatedAlephHttpClient(account=ethereum_account, api_server="http://localhost")
244+
client = AuthenticatedAlephHttpClient(
245+
account=ethereum_account, api_server="http://localhost"
246+
)
240247
client.http_session = http_session
241248

242249
return client

tests/unit/test_asynchronous.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async def test_prepare_aleph_message(
189189

190190
@pytest.mark.asyncio
191191
async def test_create_instance_insufficient_funds_error(
192-
mock_session_with_rejected_message
192+
mock_session_with_rejected_message,
193193
):
194194
async with mock_session_with_rejected_message as session:
195195
with pytest.raises(InsufficientFundsError):
@@ -199,4 +199,4 @@ async def test_create_instance_insufficient_funds_error(
199199
rootfs_name="rootfs",
200200
channel="TEST",
201201
metadata={"tags": ["test"]},
202-
)
202+
)

tests/unit/test_asynchronous_get.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from aleph_message.models import MessagesResponse, MessageType
66

7-
from aleph.sdk.exceptions import ForgottenMessageError, InvalidMessageError
7+
from aleph.sdk.exceptions import ForgottenMessageError
88
from aleph.sdk.query.filters import MessageFilter, PostFilter
99
from aleph.sdk.query.responses import PostsResponse
1010
from tests.unit.conftest import make_mock_get_session
@@ -87,13 +87,12 @@ async def test_get_forgotten_message():
8787

8888
@pytest.mark.asyncio
8989
async def test_get_message_error(rejected_message):
90-
mock_session = make_mock_get_session(
91-
rejected_message
92-
)
90+
mock_session = make_mock_get_session(rejected_message)
9391
async with mock_session as session:
9492
error = await session.get_message_error(rejected_message["item_hash"])
9593
assert error["error_code"] == rejected_message["error_code"]
9694
assert error["details"] == rejected_message["details"]
9795

96+
9897
if __name__ == "__main __":
9998
unittest.main()

0 commit comments

Comments
 (0)