From 830d58c6c46ac96e7024ad489238cce6052c8335 Mon Sep 17 00:00:00 2001 From: meejah Date: Sat, 4 Jun 2022 02:51:16 -0600 Subject: [PATCH] darken --- src/_zkapauthorizer/recover.py | 6 ++- .../tests/test_client_resource.py | 52 ++++++++++--------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/_zkapauthorizer/recover.py b/src/_zkapauthorizer/recover.py index a85da195..740eb2c9 100644 --- a/src/_zkapauthorizer/recover.py +++ b/src/_zkapauthorizer/recover.py @@ -119,7 +119,11 @@ async def recover( :param cursor: A database cursor which can be used to populate the database with recovered state. """ - if self._state.stage not in {RecoveryStages.inactive, RecoveryStages.download_failed, RecoveryStages.import_failed}: + if self._state.stage not in { + RecoveryStages.inactive, + RecoveryStages.download_failed, + RecoveryStages.import_failed, + }: return self._set_state(RecoveryState(stage=RecoveryStages.started)) diff --git a/src/_zkapauthorizer/tests/test_client_resource.py b/src/_zkapauthorizer/tests/test_client_resource.py index 0bcfc4c2..9f8b5009 100644 --- a/src/_zkapauthorizer/tests/test_client_resource.py +++ b/src/_zkapauthorizer/tests/test_client_resource.py @@ -1056,18 +1056,20 @@ async def recover(): lambda messages: list( loads(args[0]) for (args, kwargs) in messages ), - Equals([ - { - "stage": "started", - "failure-reason": None, - }, - # "our" downloader (above) doesn't set any downloading etc - # state-updates - { - "stage": "download_failed", - "failure-reason": "downloader fails", - }, - ]), + Equals( + [ + { + "stage": "started", + "failure-reason": None, + }, + # "our" downloader (above) doesn't set any downloading etc + # state-updates + { + "stage": "download_failed", + "failure-reason": "downloader fails", + }, + ] + ), ) ), ) @@ -1079,18 +1081,20 @@ async def recover(): lambda messages: list( loads(args[0]) for (args, kwargs) in messages ), - Equals([ - { - "stage": "started", - "failure-reason": None, - }, - # "our" downloader (above) doesn't set any downloading etc - # state-updates - { - "stage": "succeeded", - "failure-reason": None, - }, - ]), + Equals( + [ + { + "stage": "started", + "failure-reason": None, + }, + # "our" downloader (above) doesn't set any downloading etc + # state-updates + { + "stage": "succeeded", + "failure-reason": None, + }, + ] + ), ) ), )