Skip to content

Commit bbeb43c

Browse files
committed
Get rid of unused exceptions
1 parent 9b2a4d8 commit bbeb43c

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

Diff for: openapi_core/exceptions.py

-17
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ class OpenAPIError(Exception):
66
pass
77

88

9-
class OpenAPIMediaTypeError(OpenAPIError):
10-
pass
11-
12-
13-
@attr.s(hash=True)
14-
class InvalidContentType(OpenAPIMediaTypeError):
15-
mimetype = attr.ib()
16-
17-
def __str__(self):
18-
return "Content for following mimetype not found: {0}".format(
19-
self.mimetype)
20-
21-
229
class OpenAPIParameterError(OpenAPIError):
2310
pass
2411

@@ -67,7 +54,3 @@ class MissingResponseContent(OpenAPIResponseError):
6754

6855
def __str__(self):
6956
return "Missing response content"
70-
71-
72-
class OpenAPISchemaError(OpenAPIError):
73-
pass

Diff for: openapi_core/validation/request/shortcuts.py

-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
"""OpenAPI core validation request shortcuts module"""
22
import warnings
33

4-
from openapi_core.exceptions import (
5-
OpenAPIMediaTypeError, OpenAPIParameterError, OpenAPIRequestBodyError,
6-
OpenAPISchemaError,
7-
)
84
from openapi_core.validation.request.validators import RequestValidator
95

10-
ERRORS_BODY = (
11-
OpenAPIRequestBodyError, OpenAPIMediaTypeError, OpenAPISchemaError,
12-
)
13-
ERRORS_PARAMETERS = (
14-
OpenAPIParameterError,
15-
)
16-
176

187
def validate_request(validator, request, failsafe=None):
198
if failsafe is None:

Diff for: tests/unit/unmarshalling/test_validate.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pytest
55

66
from openapi_core.extensions.models.models import Model
7-
from openapi_core.exceptions import OpenAPISchemaError
87
from openapi_core.spec.paths import SpecPath
98
from openapi_core.unmarshalling.schemas.factories import (
109
SchemaUnmarshallersFactory,
@@ -55,8 +54,6 @@ def test_nullable(self, schema_type, validator_factory):
5554

5655
assert result is None
5756

58-
@pytest.mark.xfail(
59-
reason="validation does not care about custom formats atm")
6057
def test_string_format_custom_missing(self, validator_factory):
6158
custom_format = 'custom'
6259
spec = {
@@ -66,7 +63,7 @@ def test_string_format_custom_missing(self, validator_factory):
6663
schema = SpecPath.from_spec(spec)
6764
value = 'x'
6865

69-
with pytest.raises(OpenAPISchemaError):
66+
with pytest.raises(FormatterNotFoundError):
7067
validator_factory(schema).validate(value)
7168

7269
@pytest.mark.parametrize('value', [False, True])

0 commit comments

Comments
 (0)