Skip to content

Commit

Permalink
Prefer capitalised acronyms as per PEP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
DevL committed Mar 20, 2024
1 parent 74fe124 commit 8da4afc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/requtests/parsed_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from urllib.parse import parse_qs, urlparse


class CannotParseBodyAsJson(RuntimeError):
class CannotParseBodyAsJSON(RuntimeError):
def __init__(self, error):
super().__init__(error)
self.error = error
Expand Down Expand Up @@ -39,7 +39,7 @@ def json(self) -> Any:
try:
return json.loads(self.prepared_request.body)
except (TypeError, JSONDecodeError) as e:
raise CannotParseBodyAsJson(e)
raise CannotParseBodyAsJSON(e)

@property
def method(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions tests/parsed_request_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest
import re
from requtests import ParsedRequest
from requtests.parsed_request import CannotParseBodyAsJson
from requtests.parsed_request import CannotParseBodyAsJSON
from tests.test_utils import build_request


Expand Down Expand Up @@ -51,7 +51,7 @@ def test_parsing_a_prepared_request(prepared_request):
def test_json_with_an_empty_body(parsed_request):
parsed_request.prepared_request.body = None
expected_message = "the JSON object must be str, bytes or bytearray, not NoneType"
with pytest.raises(CannotParseBodyAsJson, match=expected_message) as exc_info:
with pytest.raises(CannotParseBodyAsJSON, match=expected_message) as exc_info:
parsed_request.json
underlying_error = exc_info.value.error
assert isinstance(underlying_error, TypeError)
Expand All @@ -60,7 +60,7 @@ def test_json_with_an_empty_body(parsed_request):
def test_json_with_an_invalid_json_body(parsed_request):
parsed_request.prepared_request.body = '{"broken": "json'
expected_message = re.escape("Unterminated string starting at: line 1 column 12 (char 11)")
with pytest.raises(CannotParseBodyAsJson, match=expected_message) as exc_info:
with pytest.raises(CannotParseBodyAsJSON, match=expected_message) as exc_info:
parsed_request.json
underlying_error = exc_info.value.error
assert isinstance(underlying_error, JSONDecodeError)
Expand Down

0 comments on commit 8da4afc

Please sign in to comment.