From 3bae579248ca4c8ac0a4bce01f8cd1c6785a24b8 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Thu, 21 Dec 2023 11:44:36 -0600 Subject: [PATCH] really fix mypy --- resources/cleanup_scripts/restore_from_backup.py | 2 +- tests/test_files.py | 2 +- tests/test_server.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/cleanup_scripts/restore_from_backup.py b/resources/cleanup_scripts/restore_from_backup.py index 903cbe7..74b812d 100644 --- a/resources/cleanup_scripts/restore_from_backup.py +++ b/resources/cleanup_scripts/restore_from_backup.py @@ -27,7 +27,7 @@ async def already_in_fc(rc: RestClient, uuid: str, logical_name: str) -> bool: await rc.request("GET", "/api/files/" + uuid) return True except requests.exceptions.HTTPError as e: - if e and e.response.status_code != 404: + if e.response and e.response.status_code != 404: raise # now sanity check that the logical_name isn't already in the FC diff --git a/tests/test_files.py b/tests/test_files.py index f9ff555..9275720 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -40,8 +40,8 @@ def copy_without_rest_response_keys(data: StrDict) -> StrDict: def _assert_httperror(exception: Exception, code: int, reason: str) -> None: """Assert that this is the expected HTTPError.""" print(exception) - assert exception is not None assert isinstance(exception, requests.exceptions.HTTPError) + assert exception.response is not None assert exception.response.status_code == code assert exception.response.reason == reason diff --git a/tests/test_server.py b/tests/test_server.py index 2e32dfb..e4d402f 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -13,8 +13,8 @@ def _assert_httperror(exception: Exception, code: int, reason: str) -> None: """Assert that this is the expected HTTPError.""" print(exception) - assert exception is not None assert isinstance(exception, requests.exceptions.HTTPError) + assert exception.response is not None assert exception.response.status_code == code assert exception.response.reason == reason