From ed602405df8e4ddf9e7993e42eea9a5e9afd4856 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sat, 6 May 2023 20:09:19 +0100 Subject: Apply fixes for ruff linting --- tests/pydis_core/test_api.py | 8 ++++---- tests/pydis_core/utils/test_regex.py | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/pydis_core/test_api.py b/tests/pydis_core/test_api.py index 92444e19..56977f07 100644 --- a/tests/pydis_core/test_api.py +++ b/tests/pydis_core/test_api.py @@ -32,7 +32,7 @@ class APIClientTests(unittest.IsolatedAsyncioTestCase): def test_response_code_error_initialization_with_json(self): """Test the initialization of `ResponseCodeError` with json.""" - json_data = {'hello': 'world'} + json_data = {"hello": "world"} error = site_api.ResponseCodeError( response=self.error_api_response, response_json=json_data, @@ -42,7 +42,7 @@ class APIClientTests(unittest.IsolatedAsyncioTestCase): def test_response_code_error_string_representation_with_nonempty_response_json(self): """Test the string representation of `ResponseCodeError` initialized with json.""" - json_data = {'hello': 'world'} + json_data = {"hello": "world"} error = site_api.ResponseCodeError( response=self.error_api_response, response_json=json_data @@ -51,7 +51,7 @@ class APIClientTests(unittest.IsolatedAsyncioTestCase): def test_response_code_error_initialization_with_text(self): """Test the initialization of `ResponseCodeError` with text.""" - text_data = 'Lemon will eat your soul' + text_data = "Lemon will eat your soul" error = site_api.ResponseCodeError( response=self.error_api_response, response_text=text_data, @@ -61,7 +61,7 @@ class APIClientTests(unittest.IsolatedAsyncioTestCase): def test_response_code_error_string_representation_with_nonempty_response_text(self): """Test the string representation of `ResponseCodeError` initialized with text.""" - text_data = 'Lemon will eat your soul' + text_data = "Lemon will eat your soul" error = site_api.ResponseCodeError( response=self.error_api_response, response_text=text_data diff --git a/tests/pydis_core/utils/test_regex.py b/tests/pydis_core/utils/test_regex.py index 01a2412b..1cf90711 100644 --- a/tests/pydis_core/utils/test_regex.py +++ b/tests/pydis_core/utils/test_regex.py @@ -1,10 +1,9 @@ import unittest -from typing import Optional from pydis_core.utils.regex import DISCORD_INVITE -def match_regex(s: str) -> Optional[str]: +def match_regex(s: str) -> str | None: """Helper function to run re.match on a string. Return the invite capture group, if the string matches the pattern @@ -14,7 +13,7 @@ def match_regex(s: str) -> Optional[str]: return result if result is None else result.group("invite") -def search_regex(s: str) -> Optional[str]: +def search_regex(s: str) -> str | None: """Helper function to run re.search on a string. Return the invite capture group, if the string matches the pattern -- cgit v1.2.3