[python-experimental] improves method names (#13325)

* Replaces all validate methods with public validate ones

* More methods made public with _oapg suffix

* Makes methods private where one can

* Fixes tests

* Fixes typo, maked Disciminable methods public

* Method changed to from_openapi_data_oapg

* Fixes tests for from_openapi_data_oapg

* Tweaks endpoint stub so the endpoint exists for ycharm type hints

* Makes Api methods protected

* Adds binary python type hints, makes get_new_instance_without_conversion_oapg public

* Protects some schema methods

* Protects more schema methods

* Renames as_x, is_x acessors with needed suffix

* Fixes some tests

* Fixes tests, fixes new signature for DateSchema

* Methods removed and made private

* Fixes indentation

* Samples regenerated
This commit is contained in:
Justin Black 2022-09-01 00:34:05 -07:00 committed by GitHub
parent d1f44e8a7e
commit 62e28a27dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1143 changed files with 30344 additions and 6451 deletions

View File

@ -37,19 +37,19 @@ object schema properties as classes
- ingested None will subclass NoneClass - ingested None will subclass NoneClass
- ingested True will subclass BoolClass - ingested True will subclass BoolClass
- ingested False will subclass BoolClass - ingested False will subclass BoolClass
- So if you need to check is True/False/None, instead use instance.is_true()/.is_false()/.is_none() - So if you need to check is True/False/None, instead use instance.is_true_oapg()/.is_false_oapg()/.is_none_oapg()
5. All validated class instances are immutable except for ones based on io.File 5. All validated class instances are immutable except for ones based on io.File
- This is because if properties were changed after validation, that validation would no longer apply - This is because if properties were changed after validation, that validation would no longer apply
- So no changing values or property values after a class has been instantiated - So no changing values or property values after a class has been instantiated
6. String + Number types with formats 6. String + Number types with formats
- String type data is stored as a string and if you need to access types based on its format like date, - String type data is stored as a string and if you need to access types based on its format like date,
date-time, uuid, number etc then you will need to use accessor functions on the instance date-time, uuid, number etc then you will need to use accessor functions on the instance
- type string + format: See .as_date, .as_datetime, .as_decimal, .as_uuid - type string + format: See .as_date_oapg, .as_datetime_oapg, .as_decimal_oapg, .as_uuid_oapg
- type number + format: See .as_float, .as_int - type number + format: See .as_float_oapg, .as_int_oapg
- this was done because openapi/json-schema defines constraints. string data may be type string with no format - this was done because openapi/json-schema defines constraints. string data may be type string with no format
keyword in one schema, and include a format constraint in another schema keyword in one schema, and include a format constraint in another schema
- So if you need to access a string format based type, use as_date/as_datetime/as_decimal/as_uuid/ - So if you need to access a string format based type, use as_date_oapg/as_datetime_oapg/as_decimal_oapg/as_uuid_oapg
- So if you need to access a number format based type, use as_int/as_float - So if you need to access a number format based type, use as_int_oapg/as_float_oapg
7. If object(dict) properties are accessed and they do not exist, then two things could happen 7. If object(dict) properties are accessed and they do not exist, then two things could happen
- When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload, - When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload,
then two possible results can be returned. If someProp is defined in any of the validated schemas then two possible results can be returned. If someProp is defined in any of the validated schemas
@ -58,6 +58,12 @@ object schema properties as classes
- This was done so type hints for optional properties could show that schemas.Unset is a valid value. - This was done so type hints for optional properties could show that schemas.Unset is a valid value.
- So you will need to update code to handle thrown KeyErrors or schema.unset values - So you will need to update code to handle thrown KeyErrors or schema.unset values
### Why are Oapg and _oapg used in class and method names?
Classes can have arbitrarily named properties set on them
Endpoints can have arbitrary operationId method names set
For those reasons, I use the prefix Oapg and _oapg to greatly reduce the likelihood of collisions
on protected + public classes/methods.
oapg stands for OpenApi Python Generator.
### Object property spec case ### Object property spec case
This was done because when payloads are ingested, they can be validated against N number of schemas. This was done because when payloads are ingested, they can be validated against N number of schemas.

View File

@ -88,31 +88,31 @@ class ParameterStyle(enum.Enum):
class PrefixSeparatorIterator: class PrefixSeparatorIterator:
# A class to store prefixes and separators for rfc6570 expansions # A class to store prefixes and separators for rfc6570 expansions
def __init__(self, prefix: str, separator: str): def __init__(self, prefix: str, separator: str):
self.prefix = prefix self.prefix = prefix
self.separator = separator self.separator = separator
self.first = True self.first = True
if separator in {'.', '|', '%20'}: if separator in {'.', '|', '%20'}:
item_separator = separator item_separator = separator
else: else:
item_separator = ',' item_separator = ','
self.item_separator = item_separator self.item_separator = item_separator
def __iter__(self): def __iter__(self):
return self return self
def __next__(self): def __next__(self):
if self.first: if self.first:
self.first = False self.first = False
return self.prefix return self.prefix
return self.separator return self.separator
class ParameterSerializerBase: class ParameterSerializerBase:
@classmethod @classmethod
def get_default_explode(cls, style: ParameterStyle) -> bool: def _get_default_explode(cls, style: ParameterStyle) -> bool:
return False return False
@staticmethod @staticmethod
@ -142,7 +142,7 @@ class ParameterSerializerBase:
raise ApiValueError('Unable to generate a ref6570 item representation of {}'.format(in_data)) raise ApiValueError('Unable to generate a ref6570 item representation of {}'.format(in_data))
@staticmethod @staticmethod
def to_dict(name: str, value: str): def _to_dict(name: str, value: str):
return {name: value} return {name: value}
@classmethod @classmethod
@ -224,7 +224,7 @@ class ParameterSerializerBase:
) )
@classmethod @classmethod
def ref6570_expansion( def _ref6570_expansion(
cls, cls,
variable_name: str, variable_name: str,
in_data: typing.Any, in_data: typing.Any,
@ -276,12 +276,12 @@ class ParameterSerializerBase:
class StyleFormSerializer(ParameterSerializerBase): class StyleFormSerializer(ParameterSerializerBase):
@classmethod @classmethod
def get_default_explode(cls, style: ParameterStyle) -> bool: def _get_default_explode(cls, style: ParameterStyle) -> bool:
if style is ParameterStyle.FORM: if style is ParameterStyle.FORM:
return True return True
return super().get_default_explode(style) return super()._get_default_explode(style)
def serialize_form( def _serialize_form(
self, self,
in_data: typing.Union[None, int, float, str, bool, dict, list], in_data: typing.Union[None, int, float, str, bool, dict, list],
name: str, name: str,
@ -291,7 +291,7 @@ class StyleFormSerializer(ParameterSerializerBase):
) -> str: ) -> str:
if prefix_separator_iterator is None: if prefix_separator_iterator is None:
prefix_separator_iterator = PrefixSeparatorIterator('?', '&') prefix_separator_iterator = PrefixSeparatorIterator('?', '&')
return self.ref6570_expansion( return self._ref6570_expansion(
variable_name=name, variable_name=name,
in_data=in_data, in_data=in_data,
explode=explode, explode=explode,
@ -302,7 +302,7 @@ class StyleFormSerializer(ParameterSerializerBase):
class StyleSimpleSerializer(ParameterSerializerBase): class StyleSimpleSerializer(ParameterSerializerBase):
def serialize_simple( def _serialize_simple(
self, self,
in_data: typing.Union[None, int, float, str, bool, dict, list], in_data: typing.Union[None, int, float, str, bool, dict, list],
name: str, name: str,
@ -310,7 +310,7 @@ class StyleSimpleSerializer(ParameterSerializerBase):
percent_encode: bool percent_encode: bool
) -> str: ) -> str:
prefix_separator_iterator = PrefixSeparatorIterator('', ',') prefix_separator_iterator = PrefixSeparatorIterator('', ',')
return self.ref6570_expansion( return self._ref6570_expansion(
variable_name=name, variable_name=name,
in_data=in_data, in_data=in_data,
explode=explode, explode=explode,
@ -392,15 +392,6 @@ class ParameterBase:
self.schema = schema self.schema = schema
self.content = content self.content = content
@staticmethod
def _remove_empty_and_cast(
in_data: typing.Tuple[typing.Tuple[str, str]],
) -> typing.Dict[str, str]:
data = tuple(t for t in in_data if t)
if not data:
return dict()
return dict(data)
def _serialize_json( def _serialize_json(
self, self,
in_data: typing.Union[None, int, float, str, bool, dict, list] in_data: typing.Union[None, int, float, str, bool, dict, list]
@ -431,45 +422,45 @@ class PathParameter(ParameterBase, StyleSimpleSerializer):
content=content content=content
) )
def _serialize_label( def __serialize_label(
self, self,
in_data: typing.Union[None, int, float, str, bool, dict, list] in_data: typing.Union[None, int, float, str, bool, dict, list]
) -> typing.Dict[str, str]: ) -> typing.Dict[str, str]:
prefix_separator_iterator = PrefixSeparatorIterator('.', '.') prefix_separator_iterator = PrefixSeparatorIterator('.', '.')
value = self.ref6570_expansion( value = self._ref6570_expansion(
variable_name=self.name, variable_name=self.name,
in_data=in_data, in_data=in_data,
explode=self.explode, explode=self.explode,
percent_encode=True, percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator prefix_separator_iterator=prefix_separator_iterator
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
def _serialize_matrix( def __serialize_matrix(
self, self,
in_data: typing.Union[None, int, float, str, bool, dict, list] in_data: typing.Union[None, int, float, str, bool, dict, list]
) -> typing.Dict[str, str]: ) -> typing.Dict[str, str]:
prefix_separator_iterator = PrefixSeparatorIterator(';', ';') prefix_separator_iterator = PrefixSeparatorIterator(';', ';')
value = self.ref6570_expansion( value = self._ref6570_expansion(
variable_name=self.name, variable_name=self.name,
in_data=in_data, in_data=in_data,
explode=self.explode, explode=self.explode,
percent_encode=True, percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator prefix_separator_iterator=prefix_separator_iterator
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
def _serialize_simple( def __serialize_simple(
self, self,
in_data: typing.Union[None, int, float, str, bool, dict, list], in_data: typing.Union[None, int, float, str, bool, dict, list],
) -> typing.Dict[str, str]: ) -> typing.Dict[str, str]:
value = self.serialize_simple( value = self._serialize_simple(
in_data=in_data, in_data=in_data,
name=self.name, name=self.name,
explode=self.explode, explode=self.explode,
percent_encode=True percent_encode=True
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
def serialize( def serialize(
self, self,
@ -490,18 +481,18 @@ class PathParameter(ParameterBase, StyleSimpleSerializer):
""" """
if self.style: if self.style:
if self.style is ParameterStyle.SIMPLE: if self.style is ParameterStyle.SIMPLE:
return self._serialize_simple(cast_in_data) return self.__serialize_simple(cast_in_data)
elif self.style is ParameterStyle.LABEL: elif self.style is ParameterStyle.LABEL:
return self._serialize_label(cast_in_data) return self.__serialize_label(cast_in_data)
elif self.style is ParameterStyle.MATRIX: elif self.style is ParameterStyle.MATRIX:
return self._serialize_matrix(cast_in_data) return self.__serialize_matrix(cast_in_data)
# self.content will be length one # self.content will be length one
for content_type, schema in self.content.items(): for content_type, schema in self.content.items():
cast_in_data = schema(in_data) cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data) cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type: if content_type == self._json_content_type:
value = self._serialize_json(cast_in_data) value = self._serialize_json(cast_in_data)
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@ -518,7 +509,7 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None
): ):
used_style = ParameterStyle.FORM if style is None and content is None and schema else style used_style = ParameterStyle.FORM if style is None and content is None and schema else style
used_explode = self.get_default_explode(used_style) if explode is None else explode used_explode = self._get_default_explode(used_style) if explode is None else explode
super().__init__( super().__init__(
name, name,
@ -538,14 +529,14 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
) -> typing.Dict[str, str]: ) -> typing.Dict[str, str]:
if prefix_separator_iterator is None: if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator() prefix_separator_iterator = self.get_prefix_separator_iterator()
value = self.ref6570_expansion( value = self._ref6570_expansion(
variable_name=self.name, variable_name=self.name,
in_data=in_data, in_data=in_data,
explode=self.explode, explode=self.explode,
percent_encode=True, percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator prefix_separator_iterator=prefix_separator_iterator
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
def __serialize_pipe_delimited( def __serialize_pipe_delimited(
self, self,
@ -554,14 +545,14 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
) -> typing.Dict[str, str]: ) -> typing.Dict[str, str]:
if prefix_separator_iterator is None: if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator() prefix_separator_iterator = self.get_prefix_separator_iterator()
value = self.ref6570_expansion( value = self._ref6570_expansion(
variable_name=self.name, variable_name=self.name,
in_data=in_data, in_data=in_data,
explode=self.explode, explode=self.explode,
percent_encode=True, percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator prefix_separator_iterator=prefix_separator_iterator
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
def __serialize_form( def __serialize_form(
self, self,
@ -570,14 +561,14 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
) -> typing.Dict[str, str]: ) -> typing.Dict[str, str]:
if prefix_separator_iterator is None: if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator() prefix_separator_iterator = self.get_prefix_separator_iterator()
value = self.serialize_form( value = self._serialize_form(
in_data, in_data,
name=self.name, name=self.name,
explode=self.explode, explode=self.explode,
percent_encode=True, percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator prefix_separator_iterator=prefix_separator_iterator
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
def get_prefix_separator_iterator(self) -> typing.Optional[PrefixSeparatorIterator]: def get_prefix_separator_iterator(self) -> typing.Optional[PrefixSeparatorIterator]:
if not self.schema: if not self.schema:
@ -625,7 +616,7 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
cast_in_data = self._json_encoder.default(cast_in_data) cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type: if content_type == self._json_content_type:
value = self._serialize_json(cast_in_data) value = self._serialize_json(cast_in_data)
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@ -642,7 +633,7 @@ class CookieParameter(ParameterBase, StyleFormSerializer):
content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None
): ):
used_style = ParameterStyle.FORM if style is None and content is None and schema else style used_style = ParameterStyle.FORM if style is None and content is None and schema else style
used_explode = self.get_default_explode(used_style) if explode is None else explode used_explode = self._get_default_explode(used_style) if explode is None else explode
super().__init__( super().__init__(
name, name,
@ -672,21 +663,21 @@ class CookieParameter(ParameterBase, StyleFormSerializer):
TODO add escaping of comma, space, equals TODO add escaping of comma, space, equals
or turn encoding on or turn encoding on
""" """
value = self.serialize_form( value = self._serialize_form(
cast_in_data, cast_in_data,
explode=self.explode, explode=self.explode,
name=self.name, name=self.name,
percent_encode=False, percent_encode=False,
prefix_separator_iterator=PrefixSeparatorIterator('', '&') prefix_separator_iterator=PrefixSeparatorIterator('', '&')
) )
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
# self.content will be length one # self.content will be length one
for content_type, schema in self.content.items(): for content_type, schema in self.content.items():
cast_in_data = schema(in_data) cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data) cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type: if content_type == self._json_content_type:
value = self._serialize_json(cast_in_data) value = self._serialize_json(cast_in_data)
return self.to_dict(self.name, value) return self._to_dict(self.name, value)
raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type))
@ -721,12 +712,6 @@ class HeaderParameter(ParameterBase, StyleSimpleSerializer):
headers.extend(data) headers.extend(data)
return headers return headers
def _serialize_simple(
self,
in_data: typing.Union[None, int, float, str, bool, dict, list],
) -> str:
return self.serialize_simple(in_data, self.name, self.explode, False)
def serialize( def serialize(
self, self,
in_data: typing.Union[ in_data: typing.Union[
@ -741,7 +726,7 @@ class HeaderParameter(ParameterBase, StyleSimpleSerializer):
returns headers: dict returns headers: dict
""" """
if self.style: if self.style:
value = self._serialize_simple(cast_in_data) value = self._serialize_simple(cast_in_data, self.name, self.explode, False)
return self.__to_headers(((self.name, value),)) return self.__to_headers(((self.name, value),))
# self.content will be length one # self.content will be length one
for content_type, schema in self.content.items(): for content_type, schema in self.content.items():
@ -929,7 +914,7 @@ class OpenApiResponse(JSONDetector):
content_type = 'multipart/form-data' content_type = 'multipart/form-data'
else: else:
raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type)) raise NotImplementedError('Deserialization of {} has not yet been implemented'.format(content_type))
deserialized_body = body_schema._from_openapi_data( deserialized_body = body_schema.from_openapi_data_oapg(
body_data, _configuration=configuration) body_data, _configuration=configuration)
elif streamed: elif streamed:
response.release_conn() response.release_conn()
@ -1263,7 +1248,7 @@ class Api:
self.api_client = api_client self.api_client = api_client
@staticmethod @staticmethod
def _verify_typed_dict_inputs(cls: typing.Type[typing.TypedDict], data: typing.Dict[str, typing.Any]): def _verify_typed_dict_inputs_oapg(cls: typing.Type[typing.TypedDict], data: typing.Dict[str, typing.Any]):
""" """
Ensures that: Ensures that:
- required keys are present - required keys are present
@ -1305,7 +1290,7 @@ class Api:
) )
) )
def get_host( def _get_host_oapg(
self, self,
operation_id: str, operation_id: str,
servers: typing.Tuple[typing.Dict[str, str], ...] = tuple(), servers: typing.Tuple[typing.Dict[str, str], ...] = tuple(),
@ -1454,7 +1439,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
raise ValueError( raise ValueError(
f'Unable to serialize {in_data} to application/x-www-form-urlencoded because it is not a dict of data') f'Unable to serialize {in_data} to application/x-www-form-urlencoded because it is not a dict of data')
cast_in_data = self.__json_encoder.default(in_data) cast_in_data = self.__json_encoder.default(in_data)
value = self.serialize_form(cast_in_data, name='', explode=True, percent_encode=False) value = self._serialize_form(cast_in_data, name='', explode=True, percent_encode=False)
return dict(body=value) return dict(body=value)
def serialize( def serialize(

View File

@ -59,7 +59,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase):
assert isinstance(api_response.response, urllib3.HTTPResponse) assert isinstance(api_response.response, urllib3.HTTPResponse)
assert isinstance(api_response.body, {{httpMethod}}.{{schema.baseName}}) assert isinstance(api_response.body, {{httpMethod}}.{{schema.baseName}})
deserialized_response_body = {{httpMethod}}.{{schema.baseName}}._from_openapi_data( deserialized_response_body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )
@ -106,7 +106,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase):
{{/with}} {{/with}}
) )
{{#if valid}} {{#if valid}}
body = {{httpMethod}}.{{schema.baseName}}._from_openapi_data( body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )
@ -120,7 +120,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase):
assert isinstance(api_response.body, schemas.Unset) assert isinstance(api_response.body, schemas.Unset)
{{else}} {{else}}
with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)): with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)):
body = {{httpMethod}}.{{schema.baseName}}._from_openapi_data( body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -3,11 +3,7 @@
{{>partial_header}} {{>partial_header}}
from dataclasses import dataclass from dataclasses import dataclass
import re # noqa: F401
import sys # noqa: F401
import typing
import urllib3 import urllib3
import functools # noqa: F401
{{#with operation}} {{#with operation}}
{{#or headerParams bodyParam produces}} {{#or headerParams bodyParam produces}}
from urllib3._collections import HTTPHeaderDict from urllib3._collections import HTTPHeaderDict
@ -375,6 +371,7 @@ _status_code_to_response = {
{{/if}} {{/if}}
{{/each}} {{/each}}
} }
{{/unless}}
{{#each produces}} {{#each produces}}
{{#if @first}} {{#if @first}}
_all_accept_content_types = ( _all_accept_content_types = (
@ -388,7 +385,7 @@ _all_accept_content_types = (
class BaseApi(api_client.Api): class BaseApi(api_client.Api):
def _{{operationId}}( def _{{operationId}}_oapg(
{{> endpoint_args selfType="api_client.Api" }} {{> endpoint_args selfType="api_client.Api" }}
""" """
{{#if summary}} {{#if summary}}
@ -399,16 +396,16 @@ class BaseApi(api_client.Api):
class instances class instances
""" """
{{#if queryParams}} {{#if queryParams}}
self._verify_typed_dict_inputs(RequestQueryParams, query_params) self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params)
{{/if}} {{/if}}
{{#if headerParams}} {{#if headerParams}}
self._verify_typed_dict_inputs(RequestHeaderParams, header_params) self._verify_typed_dict_inputs_oapg(RequestHeaderParams, header_params)
{{/if}} {{/if}}
{{#if pathParams}} {{#if pathParams}}
self._verify_typed_dict_inputs(RequestPathParams, path_params) self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params)
{{/if}} {{/if}}
{{#if cookieParams}} {{#if cookieParams}}
self._verify_typed_dict_inputs(RequestCookieParams, cookie_params) self._verify_typed_dict_inputs_oapg(RequestCookieParams, cookie_params)
{{/if}} {{/if}}
used_path = path.value used_path = path.value
{{#if pathParams}} {{#if pathParams}}
@ -486,7 +483,7 @@ class BaseApi(api_client.Api):
{{/with}} {{/with}}
{{#if servers}} {{#if servers}}
host = self.get_host('{{operationId}}', _servers, host_index) host = self._get_host_oapg('{{operationId}}', _servers, host_index)
{{/if}} {{/if}}
response = self.api_client.call_api( response = self.api_client.call_api(
@ -537,7 +534,7 @@ class {{operationIdCamelCase}}(BaseApi):
def {{operationId}}( def {{operationId}}(
{{> endpoint_args selfType="BaseApi" }} {{> endpoint_args selfType="BaseApi" }}
return self._{{operationId}}( return self._{{operationId}}_oapg(
{{> endpoint_args_passed }} {{> endpoint_args_passed }}
) )
@ -547,10 +544,9 @@ class ApiFor{{httpMethod}}(BaseApi):
def {{httpMethod}}( def {{httpMethod}}(
{{> endpoint_args selfType="BaseApi" }} {{> endpoint_args selfType="BaseApi" }}
return self._{{operationId}}( return self._{{operationId}}_oapg(
{{> endpoint_args_passed }} {{> endpoint_args_passed }}
) )
{{/unless}}
{{/with}} {{/with}}

View File

@ -2,10 +2,6 @@
{{>partial_header}} {{>partial_header}}
import re # noqa: F401
import typing # noqa: F401
import functools # noqa: F401
{{#each models}} {{#each models}}
{{#with model}} {{#with model}}
{{> model_templates/imports_schema_types }} {{> model_templates/imports_schema_types }}

View File

@ -1,5 +1,9 @@
import decimal # noqa: F401
from datetime import date, datetime # noqa: F401 from datetime import date, datetime # noqa: F401
import decimal # noqa: F401
import functools # noqa: F401
import io # noqa: F401
import re # noqa: F401
import typing # noqa: F401
import uuid # noqa: F401 import uuid # noqa: F401
import frozendict # noqa: F401 import frozendict # noqa: F401

View File

@ -1 +1 @@
{{#if isAnyType}}dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes, {{/if}}{{#if isArray}}tuple, {{/if}}{{#if isMap}}dict, frozendict.frozendict, {{/if}}{{#if isNull}}None, {{/if}}{{#or isString isByteArray}}str, {{/or}}{{#or isUnboundedInteger isShort isLong}}int, {{/or}}{{#or isFloat isDouble}}float, {{/or}}{{#if isNumber}}decimal.Decimal, int, float, {{/if}}{{#if isDate}}date, str, {{/if}}{{#if isUuid}}uuid.UUID, str, {{/if}}{{#if isDateTime}}datetime, str, {{/if}}{{#if isDecimal}}str, {{/if}}{{#if isBoolean}}bool, {{/if}} {{#if isAnyType}}dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes, {{/if}}{{#if isArray}}tuple, {{/if}}{{#if isMap}}dict, frozendict.frozendict, {{/if}}{{#if isNull}}None, {{/if}}{{#or isString isByteArray}}str, {{/or}}{{#or isUnboundedInteger isShort isLong}}int, {{/or}}{{#or isFloat isDouble}}float, {{/or}}{{#if isNumber}}decimal.Decimal, int, float, {{/if}}{{#if isDate}}date, str, {{/if}}{{#if isUuid}}uuid.UUID, str, {{/if}}{{#if isDateTime}}datetime, str, {{/if}}{{#if isDecimal}}str, {{/if}}{{#if isBoolean}}bool, {{/if}}{{#if isBinary}}bytes, io.FileIO, io.BufferedReader, {{/if}}

View File

@ -20,7 +20,7 @@ class Test{{classname}}(unittest.TestCase):
def test_{{@key}}_{{#if valid}}passes{{else}}fails{{/if}}(self): def test_{{@key}}_{{#if valid}}passes{{else}}fails{{/if}}(self):
# {{description}} # {{description}}
{{#if valid}} {{#if valid}}
{{classname}}._from_openapi_data( {{classname}}.from_openapi_data_oapg(
{{#with data}} {{#with data}}
{{> model_templates/payload_renderer endChar=',' }} {{> model_templates/payload_renderer endChar=',' }}
{{/with}} {{/with}}
@ -28,7 +28,7 @@ class Test{{classname}}(unittest.TestCase):
) )
{{else}} {{else}}
with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)): with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)):
{{classname}}._from_openapi_data( {{classname}}.from_openapi_data_oapg(
{{#with data}} {{#with data}}
{{> model_templates/payload_renderer endChar=','}} {{> model_templates/payload_renderer endChar=','}}
{{/with}} {{/with}}

View File

@ -29,19 +29,19 @@ object schema properties as classes
- ingested None will subclass NoneClass - ingested None will subclass NoneClass
- ingested True will subclass BoolClass - ingested True will subclass BoolClass
- ingested False will subclass BoolClass - ingested False will subclass BoolClass
- So if you need to check is True/False/None, instead use instance.is_true()/.is_false()/.is_none() - So if you need to check is True/False/None, instead use instance.is_true_oapg()/.is_false_oapg()/.is_none_oapg()
5. All validated class instances are immutable except for ones based on io.File 5. All validated class instances are immutable except for ones based on io.File
- This is because if properties were changed after validation, that validation would no longer apply - This is because if properties were changed after validation, that validation would no longer apply
- So no changing values or property values after a class has been instantiated - So no changing values or property values after a class has been instantiated
6. String + Number types with formats 6. String + Number types with formats
- String type data is stored as a string and if you need to access types based on its format like date, - String type data is stored as a string and if you need to access types based on its format like date,
date-time, uuid, number etc then you will need to use accessor functions on the instance date-time, uuid, number etc then you will need to use accessor functions on the instance
- type string + format: See .as_date, .as_datetime, .as_decimal, .as_uuid - type string + format: See .as_date_oapg, .as_datetime_oapg, .as_decimal_oapg, .as_uuid_oapg
- type number + format: See .as_float, .as_int - type number + format: See .as_float_oapg, .as_int_oapg
- this was done because openapi/json-schema defines constraints. string data may be type string with no format - this was done because openapi/json-schema defines constraints. string data may be type string with no format
keyword in one schema, and include a format constraint in another schema keyword in one schema, and include a format constraint in another schema
- So if you need to access a string format based type, use as_date/as_datetime/as_decimal/as_uuid/ - So if you need to access a string format based type, use as_date_oapg/as_datetime_oapg/as_decimal_oapg/as_uuid_oapg
- So if you need to access a number format based type, use as_int/as_float - So if you need to access a number format based type, use as_int_oapg/as_float_oapg
7. If object(dict) properties are accessed and they do not exist, then two things could happen 7. If object(dict) properties are accessed and they do not exist, then two things could happen
- When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload, - When accessed with model_instance.someProp or model_instance["someProp"] and someProp is not in the payload,
then two possible results can be returned. If someProp is defined in any of the validated schemas then two possible results can be returned. If someProp is defined in any of the validated schemas
@ -50,6 +50,12 @@ object schema properties as classes
- This was done so type hints for optional properties could show that schemas.Unset is a valid value. - This was done so type hints for optional properties could show that schemas.Unset is a valid value.
- So you will need to update code to handle thrown KeyErrors or schema.unset values - So you will need to update code to handle thrown KeyErrors or schema.unset values
### Why are Oapg and _oapg used in class and method names?
Classes can have arbitrarily named properties set on them
Endpoints can have arbitrary operationId method names set
For those reasons, I use the prefix Oapg and _oapg to greatly reduce the likelihood of collisions
on protected + public classes/methods.
oapg stands for OpenApi Python Generator.
### Object property spec case ### Object property spec case
This was done because when payloads are ingested, they can be validated against N number of schemas. This was done because when payloads are ingested, they can be validated against N number of schemas.

View File

@ -22,7 +22,7 @@ class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase
def test_no_additional_properties_is_valid_passes(self): def test_no_additional_properties_is_valid_passes(self):
# no additional properties is valid # no additional properties is valid
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data( AdditionalpropertiesAllowsASchemaWhichShouldValidate.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -33,7 +33,7 @@ class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase
def test_an_additional_invalid_property_is_invalid_fails(self): def test_an_additional_invalid_property_is_invalid_fails(self):
# an additional invalid property is invalid # an additional invalid property is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data( AdditionalpropertiesAllowsASchemaWhichShouldValidate.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -47,7 +47,7 @@ class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase
def test_an_additional_valid_property_is_valid_passes(self): def test_an_additional_valid_property_is_valid_passes(self):
# an additional valid property is valid # an additional valid property is valid
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data( AdditionalpropertiesAllowsASchemaWhichShouldValidate.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,

View File

@ -22,7 +22,7 @@ class TestAdditionalpropertiesAreAllowedByDefault(unittest.TestCase):
def test_additional_properties_are_allowed_passes(self): def test_additional_properties_are_allowed_passes(self):
# additional properties are allowed # additional properties are allowed
AdditionalpropertiesAreAllowedByDefault._from_openapi_data( AdditionalpropertiesAreAllowedByDefault.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,

View File

@ -23,7 +23,7 @@ class TestAdditionalpropertiesCanExistByItself(unittest.TestCase):
def test_an_additional_invalid_property_is_invalid_fails(self): def test_an_additional_invalid_property_is_invalid_fails(self):
# an additional invalid property is invalid # an additional invalid property is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AdditionalpropertiesCanExistByItself._from_openapi_data( AdditionalpropertiesCanExistByItself.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -33,7 +33,7 @@ class TestAdditionalpropertiesCanExistByItself(unittest.TestCase):
def test_an_additional_valid_property_is_valid_passes(self): def test_an_additional_valid_property_is_valid_passes(self):
# an additional valid property is valid # an additional valid property is valid
AdditionalpropertiesCanExistByItself._from_openapi_data( AdditionalpropertiesCanExistByItself.from_openapi_data_oapg(
{ {
"foo": "foo":
True, True,

View File

@ -23,7 +23,7 @@ class TestAdditionalpropertiesShouldNotLookInApplicators(unittest.TestCase):
def test_properties_defined_in_allof_are_not_examined_fails(self): def test_properties_defined_in_allof_are_not_examined_fails(self):
# properties defined in allOf are not examined # properties defined in allOf are not examined
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AdditionalpropertiesShouldNotLookInApplicators._from_openapi_data( AdditionalpropertiesShouldNotLookInApplicators.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -35,7 +35,7 @@ class TestAdditionalpropertiesShouldNotLookInApplicators(unittest.TestCase):
def test_valid_test_case_passes(self): def test_valid_test_case_passes(self):
# valid test case # valid test case
AdditionalpropertiesShouldNotLookInApplicators._from_openapi_data( AdditionalpropertiesShouldNotLookInApplicators.from_openapi_data_oapg(
{ {
"foo": "foo":
False, False,

View File

@ -22,7 +22,7 @@ class TestAllof(unittest.TestCase):
def test_allof_passes(self): def test_allof_passes(self):
# allOf # allOf
Allof._from_openapi_data( Allof.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",
@ -35,7 +35,7 @@ class TestAllof(unittest.TestCase):
def test_mismatch_first_fails(self): def test_mismatch_first_fails(self):
# mismatch first # mismatch first
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Allof._from_openapi_data( Allof.from_openapi_data_oapg(
{ {
"bar": "bar":
2, 2,
@ -46,7 +46,7 @@ class TestAllof(unittest.TestCase):
def test_mismatch_second_fails(self): def test_mismatch_second_fails(self):
# mismatch second # mismatch second
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Allof._from_openapi_data( Allof.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",
@ -57,7 +57,7 @@ class TestAllof(unittest.TestCase):
def test_wrong_type_fails(self): def test_wrong_type_fails(self):
# wrong type # wrong type
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Allof._from_openapi_data( Allof.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",

View File

@ -23,7 +23,7 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_true_anyof_false_oneof_false_fails(self): def test_allof_true_anyof_false_oneof_false_fails(self):
# allOf: true, anyOf: false, oneOf: false # allOf: true, anyOf: false, oneOf: false
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
2, 2,
_configuration=self._configuration _configuration=self._configuration
) )
@ -31,7 +31,7 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_false_anyof_false_oneof_true_fails(self): def test_allof_false_anyof_false_oneof_true_fails(self):
# allOf: false, anyOf: false, oneOf: true # allOf: false, anyOf: false, oneOf: true
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
5, 5,
_configuration=self._configuration _configuration=self._configuration
) )
@ -39,7 +39,7 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_false_anyof_true_oneof_true_fails(self): def test_allof_false_anyof_true_oneof_true_fails(self):
# allOf: false, anyOf: true, oneOf: true # allOf: false, anyOf: true, oneOf: true
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
15, 15,
_configuration=self._configuration _configuration=self._configuration
) )
@ -47,14 +47,14 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_true_anyof_true_oneof_false_fails(self): def test_allof_true_anyof_true_oneof_false_fails(self):
# allOf: true, anyOf: true, oneOf: false # allOf: true, anyOf: true, oneOf: false
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
6, 6,
_configuration=self._configuration _configuration=self._configuration
) )
def test_allof_true_anyof_true_oneof_true_passes(self): def test_allof_true_anyof_true_oneof_true_passes(self):
# allOf: true, anyOf: true, oneOf: true # allOf: true, anyOf: true, oneOf: true
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
30, 30,
_configuration=self._configuration _configuration=self._configuration
) )
@ -62,7 +62,7 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_true_anyof_false_oneof_true_fails(self): def test_allof_true_anyof_false_oneof_true_fails(self):
# allOf: true, anyOf: false, oneOf: true # allOf: true, anyOf: false, oneOf: true
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
10, 10,
_configuration=self._configuration _configuration=self._configuration
) )
@ -70,7 +70,7 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_false_anyof_true_oneof_false_fails(self): def test_allof_false_anyof_true_oneof_false_fails(self):
# allOf: false, anyOf: true, oneOf: false # allOf: false, anyOf: true, oneOf: false
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
3, 3,
_configuration=self._configuration _configuration=self._configuration
) )
@ -78,7 +78,7 @@ class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
def test_allof_false_anyof_false_oneof_false_fails(self): def test_allof_false_anyof_false_oneof_false_fails(self):
# allOf: false, anyOf: false, oneOf: false # allOf: false, anyOf: false, oneOf: false
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofCombinedWithAnyofOneof._from_openapi_data( AllofCombinedWithAnyofOneof.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestAllofSimpleTypes(unittest.TestCase):
def test_valid_passes(self): def test_valid_passes(self):
# valid # valid
AllofSimpleTypes._from_openapi_data( AllofSimpleTypes.from_openapi_data_oapg(
25, 25,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,7 +30,7 @@ class TestAllofSimpleTypes(unittest.TestCase):
def test_mismatch_one_fails(self): def test_mismatch_one_fails(self):
# mismatch one # mismatch one
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofSimpleTypes._from_openapi_data( AllofSimpleTypes.from_openapi_data_oapg(
35, 35,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestAllofWithBaseSchema(unittest.TestCase):
def test_valid_passes(self): def test_valid_passes(self):
# valid # valid
AllofWithBaseSchema._from_openapi_data( AllofWithBaseSchema.from_openapi_data_oapg(
{ {
"foo": "foo":
"quux", "quux",
@ -37,7 +37,7 @@ class TestAllofWithBaseSchema(unittest.TestCase):
def test_mismatch_first_allof_fails(self): def test_mismatch_first_allof_fails(self):
# mismatch first allOf # mismatch first allOf
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofWithBaseSchema._from_openapi_data( AllofWithBaseSchema.from_openapi_data_oapg(
{ {
"bar": "bar":
2, 2,
@ -50,7 +50,7 @@ class TestAllofWithBaseSchema(unittest.TestCase):
def test_mismatch_base_schema_fails(self): def test_mismatch_base_schema_fails(self):
# mismatch base schema # mismatch base schema
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofWithBaseSchema._from_openapi_data( AllofWithBaseSchema.from_openapi_data_oapg(
{ {
"foo": "foo":
"quux", "quux",
@ -63,7 +63,7 @@ class TestAllofWithBaseSchema(unittest.TestCase):
def test_mismatch_both_fails(self): def test_mismatch_both_fails(self):
# mismatch both # mismatch both
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofWithBaseSchema._from_openapi_data( AllofWithBaseSchema.from_openapi_data_oapg(
{ {
"bar": "bar":
2, 2,
@ -74,7 +74,7 @@ class TestAllofWithBaseSchema(unittest.TestCase):
def test_mismatch_second_allof_fails(self): def test_mismatch_second_allof_fails(self):
# mismatch second allOf # mismatch second allOf
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofWithBaseSchema._from_openapi_data( AllofWithBaseSchema.from_openapi_data_oapg(
{ {
"foo": "foo":
"quux", "quux",

View File

@ -22,7 +22,7 @@ class TestAllofWithOneEmptySchema(unittest.TestCase):
def test_any_data_is_valid_passes(self): def test_any_data_is_valid_passes(self):
# any data is valid # any data is valid
AllofWithOneEmptySchema._from_openapi_data( AllofWithOneEmptySchema.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestAllofWithTheFirstEmptySchema(unittest.TestCase):
def test_string_is_invalid_fails(self): def test_string_is_invalid_fails(self):
# string is invalid # string is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofWithTheFirstEmptySchema._from_openapi_data( AllofWithTheFirstEmptySchema.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_number_is_valid_passes(self): def test_number_is_valid_passes(self):
# number is valid # number is valid
AllofWithTheFirstEmptySchema._from_openapi_data( AllofWithTheFirstEmptySchema.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestAllofWithTheLastEmptySchema(unittest.TestCase):
def test_string_is_invalid_fails(self): def test_string_is_invalid_fails(self):
# string is invalid # string is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AllofWithTheLastEmptySchema._from_openapi_data( AllofWithTheLastEmptySchema.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_number_is_valid_passes(self): def test_number_is_valid_passes(self):
# number is valid # number is valid
AllofWithTheLastEmptySchema._from_openapi_data( AllofWithTheLastEmptySchema.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestAllofWithTwoEmptySchemas(unittest.TestCase):
def test_any_data_is_valid_passes(self): def test_any_data_is_valid_passes(self):
# any data is valid # any data is valid
AllofWithTwoEmptySchemas._from_openapi_data( AllofWithTwoEmptySchemas.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestAnyof(unittest.TestCase):
def test_second_anyof_valid_passes(self): def test_second_anyof_valid_passes(self):
# second anyOf valid # second anyOf valid
Anyof._from_openapi_data( Anyof.from_openapi_data_oapg(
2.5, 2.5,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,21 +30,21 @@ class TestAnyof(unittest.TestCase):
def test_neither_anyof_valid_fails(self): def test_neither_anyof_valid_fails(self):
# neither anyOf valid # neither anyOf valid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Anyof._from_openapi_data( Anyof.from_openapi_data_oapg(
1.5, 1.5,
_configuration=self._configuration _configuration=self._configuration
) )
def test_both_anyof_valid_passes(self): def test_both_anyof_valid_passes(self):
# both anyOf valid # both anyOf valid
Anyof._from_openapi_data( Anyof.from_openapi_data_oapg(
3, 3,
_configuration=self._configuration _configuration=self._configuration
) )
def test_first_anyof_valid_passes(self): def test_first_anyof_valid_passes(self):
# first anyOf valid # first anyOf valid
Anyof._from_openapi_data( Anyof.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestAnyofComplexTypes(unittest.TestCase):
def test_second_anyof_valid_complex_passes(self): def test_second_anyof_valid_complex_passes(self):
# second anyOf valid (complex) # second anyOf valid (complex)
AnyofComplexTypes._from_openapi_data( AnyofComplexTypes.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",
@ -33,7 +33,7 @@ class TestAnyofComplexTypes(unittest.TestCase):
def test_neither_anyof_valid_complex_fails(self): def test_neither_anyof_valid_complex_fails(self):
# neither anyOf valid (complex) # neither anyOf valid (complex)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AnyofComplexTypes._from_openapi_data( AnyofComplexTypes.from_openapi_data_oapg(
{ {
"foo": "foo":
2, 2,
@ -45,7 +45,7 @@ class TestAnyofComplexTypes(unittest.TestCase):
def test_both_anyof_valid_complex_passes(self): def test_both_anyof_valid_complex_passes(self):
# both anyOf valid (complex) # both anyOf valid (complex)
AnyofComplexTypes._from_openapi_data( AnyofComplexTypes.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",
@ -57,7 +57,7 @@ class TestAnyofComplexTypes(unittest.TestCase):
def test_first_anyof_valid_complex_passes(self): def test_first_anyof_valid_complex_passes(self):
# first anyOf valid (complex) # first anyOf valid (complex)
AnyofComplexTypes._from_openapi_data( AnyofComplexTypes.from_openapi_data_oapg(
{ {
"bar": "bar":
2, 2,

View File

@ -22,7 +22,7 @@ class TestAnyofWithBaseSchema(unittest.TestCase):
def test_one_anyof_valid_passes(self): def test_one_anyof_valid_passes(self):
# one anyOf valid # one anyOf valid
AnyofWithBaseSchema._from_openapi_data( AnyofWithBaseSchema.from_openapi_data_oapg(
"foobar", "foobar",
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,7 +30,7 @@ class TestAnyofWithBaseSchema(unittest.TestCase):
def test_both_anyof_invalid_fails(self): def test_both_anyof_invalid_fails(self):
# both anyOf invalid # both anyOf invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AnyofWithBaseSchema._from_openapi_data( AnyofWithBaseSchema.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
@ -38,7 +38,7 @@ class TestAnyofWithBaseSchema(unittest.TestCase):
def test_mismatch_base_schema_fails(self): def test_mismatch_base_schema_fails(self):
# mismatch base schema # mismatch base schema
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AnyofWithBaseSchema._from_openapi_data( AnyofWithBaseSchema.from_openapi_data_oapg(
3, 3,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,14 +22,14 @@ class TestAnyofWithOneEmptySchema(unittest.TestCase):
def test_string_is_valid_passes(self): def test_string_is_valid_passes(self):
# string is valid # string is valid
AnyofWithOneEmptySchema._from_openapi_data( AnyofWithOneEmptySchema.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_number_is_valid_passes(self): def test_number_is_valid_passes(self):
# number is valid # number is valid
AnyofWithOneEmptySchema._from_openapi_data( AnyofWithOneEmptySchema.from_openapi_data_oapg(
123, 123,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestArrayTypeMatchesArrays(unittest.TestCase):
def test_a_float_is_not_an_array_fails(self): def test_a_float_is_not_an_array_fails(self):
# a float is not an array # a float is not an array
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -31,7 +31,7 @@ class TestArrayTypeMatchesArrays(unittest.TestCase):
def test_a_boolean_is_not_an_array_fails(self): def test_a_boolean_is_not_an_array_fails(self):
# a boolean is not an array # a boolean is not an array
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
@ -39,7 +39,7 @@ class TestArrayTypeMatchesArrays(unittest.TestCase):
def test_null_is_not_an_array_fails(self): def test_null_is_not_an_array_fails(self):
# null is not an array # null is not an array
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
@ -47,7 +47,7 @@ class TestArrayTypeMatchesArrays(unittest.TestCase):
def test_an_object_is_not_an_array_fails(self): def test_an_object_is_not_an_array_fails(self):
# an object is not an array # an object is not an array
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -56,14 +56,14 @@ class TestArrayTypeMatchesArrays(unittest.TestCase):
def test_a_string_is_not_an_array_fails(self): def test_a_string_is_not_an_array_fails(self):
# a string is not an array # a string is not an array
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_an_array_is_an_array_passes(self): def test_an_array_is_an_array_passes(self):
# an array is an array # an array is an array
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -72,7 +72,7 @@ class TestArrayTypeMatchesArrays(unittest.TestCase):
def test_an_integer_is_not_an_array_fails(self): def test_an_integer_is_not_an_array_fails(self):
# an integer is not an array # an integer is not an array
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ArrayTypeMatchesArrays._from_openapi_data( ArrayTypeMatchesArrays.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_an_empty_string_is_not_a_boolean_fails(self): def test_an_empty_string_is_not_a_boolean_fails(self):
# an empty string is not a boolean # an empty string is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
"", "",
_configuration=self._configuration _configuration=self._configuration
) )
@ -31,7 +31,7 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_a_float_is_not_a_boolean_fails(self): def test_a_float_is_not_a_boolean_fails(self):
# a float is not a boolean # a float is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -39,7 +39,7 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_null_is_not_a_boolean_fails(self): def test_null_is_not_a_boolean_fails(self):
# null is not a boolean # null is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
@ -47,7 +47,7 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_zero_is_not_a_boolean_fails(self): def test_zero_is_not_a_boolean_fails(self):
# zero is not a boolean # zero is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
0, 0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -55,7 +55,7 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_an_array_is_not_a_boolean_fails(self): def test_an_array_is_not_a_boolean_fails(self):
# an array is not a boolean # an array is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -64,14 +64,14 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_a_string_is_not_a_boolean_fails(self): def test_a_string_is_not_a_boolean_fails(self):
# a string is not a boolean # a string is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_false_is_a_boolean_passes(self): def test_false_is_a_boolean_passes(self):
# false is a boolean # false is a boolean
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
@ -79,14 +79,14 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_an_integer_is_not_a_boolean_fails(self): def test_an_integer_is_not_a_boolean_fails(self):
# an integer is not a boolean # an integer is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
def test_true_is_a_boolean_passes(self): def test_true_is_a_boolean_passes(self):
# true is a boolean # true is a boolean
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
@ -94,7 +94,7 @@ class TestBooleanTypeMatchesBooleans(unittest.TestCase):
def test_an_object_is_not_a_boolean_fails(self): def test_an_object_is_not_a_boolean_fails(self):
# an object is not a boolean # an object is not a boolean
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BooleanTypeMatchesBooleans._from_openapi_data( BooleanTypeMatchesBooleans.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration

View File

@ -23,21 +23,21 @@ class TestByInt(unittest.TestCase):
def test_int_by_int_fail_fails(self): def test_int_by_int_fail_fails(self):
# int by int fail # int by int fail
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ByInt._from_openapi_data( ByInt.from_openapi_data_oapg(
7, 7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_int_by_int_passes(self): def test_int_by_int_passes(self):
# int by int # int by int
ByInt._from_openapi_data( ByInt.from_openapi_data_oapg(
10, 10,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_non_numbers_passes(self): def test_ignores_non_numbers_passes(self):
# ignores non-numbers # ignores non-numbers
ByInt._from_openapi_data( ByInt.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestByNumber(unittest.TestCase):
def test_45_is_multiple_of15_passes(self): def test_45_is_multiple_of15_passes(self):
# 4.5 is multiple of 1.5 # 4.5 is multiple of 1.5
ByNumber._from_openapi_data( ByNumber.from_openapi_data_oapg(
4.5, 4.5,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,14 +30,14 @@ class TestByNumber(unittest.TestCase):
def test_35_is_not_multiple_of15_fails(self): def test_35_is_not_multiple_of15_fails(self):
# 35 is not multiple of 1.5 # 35 is not multiple of 1.5
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ByNumber._from_openapi_data( ByNumber.from_openapi_data_oapg(
35, 35,
_configuration=self._configuration _configuration=self._configuration
) )
def test_zero_is_multiple_of_anything_passes(self): def test_zero_is_multiple_of_anything_passes(self):
# zero is multiple of anything # zero is multiple of anything
ByNumber._from_openapi_data( ByNumber.from_openapi_data_oapg(
0, 0,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestBySmallNumber(unittest.TestCase):
def test_000751_is_not_multiple_of00001_fails(self): def test_000751_is_not_multiple_of00001_fails(self):
# 0.00751 is not multiple of 0.0001 # 0.00751 is not multiple of 0.0001
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
BySmallNumber._from_openapi_data( BySmallNumber.from_openapi_data_oapg(
0.00751, 0.00751,
_configuration=self._configuration _configuration=self._configuration
) )
def test_00075_is_multiple_of00001_passes(self): def test_00075_is_multiple_of00001_passes(self):
# 0.0075 is multiple of 0.0001 # 0.0075 is multiple of 0.0001
BySmallNumber._from_openapi_data( BySmallNumber.from_openapi_data_oapg(
0.0075, 0.0075,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestDateTimeFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
DateTimeFormat._from_openapi_data( DateTimeFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestDateTimeFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
DateTimeFormat._from_openapi_data( DateTimeFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
DateTimeFormat._from_openapi_data( DateTimeFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
DateTimeFormat._from_openapi_data( DateTimeFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
DateTimeFormat._from_openapi_data( DateTimeFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestDateTimeFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
DateTimeFormat._from_openapi_data( DateTimeFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestEmailFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
EmailFormat._from_openapi_data( EmailFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestEmailFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
EmailFormat._from_openapi_data( EmailFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
EmailFormat._from_openapi_data( EmailFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
EmailFormat._from_openapi_data( EmailFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
EmailFormat._from_openapi_data( EmailFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestEmailFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
EmailFormat._from_openapi_data( EmailFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,14 +22,14 @@ class TestEnumWith0DoesNotMatchFalse(unittest.TestCase):
def test_integer_zero_is_valid_passes(self): def test_integer_zero_is_valid_passes(self):
# integer zero is valid # integer zero is valid
EnumWith0DoesNotMatchFalse._from_openapi_data( EnumWith0DoesNotMatchFalse.from_openapi_data_oapg(
0, 0,
_configuration=self._configuration _configuration=self._configuration
) )
def test_float_zero_is_valid_passes(self): def test_float_zero_is_valid_passes(self):
# float zero is valid # float zero is valid
EnumWith0DoesNotMatchFalse._from_openapi_data( EnumWith0DoesNotMatchFalse.from_openapi_data_oapg(
0.0, 0.0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -37,7 +37,7 @@ class TestEnumWith0DoesNotMatchFalse(unittest.TestCase):
def test_false_is_invalid_fails(self): def test_false_is_invalid_fails(self):
# false is invalid # false is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWith0DoesNotMatchFalse._from_openapi_data( EnumWith0DoesNotMatchFalse.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,21 +23,21 @@ class TestEnumWith1DoesNotMatchTrue(unittest.TestCase):
def test_true_is_invalid_fails(self): def test_true_is_invalid_fails(self):
# true is invalid # true is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWith1DoesNotMatchTrue._from_openapi_data( EnumWith1DoesNotMatchTrue.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
def test_integer_one_is_valid_passes(self): def test_integer_one_is_valid_passes(self):
# integer one is valid # integer one is valid
EnumWith1DoesNotMatchTrue._from_openapi_data( EnumWith1DoesNotMatchTrue.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
def test_float_one_is_valid_passes(self): def test_float_one_is_valid_passes(self):
# float one is valid # float one is valid
EnumWith1DoesNotMatchTrue._from_openapi_data( EnumWith1DoesNotMatchTrue.from_openapi_data_oapg(
1.0, 1.0,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,14 +22,14 @@ class TestEnumWithEscapedCharacters(unittest.TestCase):
def test_member2_is_valid_passes(self): def test_member2_is_valid_passes(self):
# member 2 is valid # member 2 is valid
EnumWithEscapedCharacters._from_openapi_data( EnumWithEscapedCharacters.from_openapi_data_oapg(
"foo\rbar", "foo\rbar",
_configuration=self._configuration _configuration=self._configuration
) )
def test_member1_is_valid_passes(self): def test_member1_is_valid_passes(self):
# member 1 is valid # member 1 is valid
EnumWithEscapedCharacters._from_openapi_data( EnumWithEscapedCharacters.from_openapi_data_oapg(
"foo\nbar", "foo\nbar",
_configuration=self._configuration _configuration=self._configuration
) )
@ -37,7 +37,7 @@ class TestEnumWithEscapedCharacters(unittest.TestCase):
def test_another_string_is_invalid_fails(self): def test_another_string_is_invalid_fails(self):
# another string is invalid # another string is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWithEscapedCharacters._from_openapi_data( EnumWithEscapedCharacters.from_openapi_data_oapg(
"abc", "abc",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestEnumWithFalseDoesNotMatch0(unittest.TestCase):
def test_false_is_valid_passes(self): def test_false_is_valid_passes(self):
# false is valid # false is valid
EnumWithFalseDoesNotMatch0._from_openapi_data( EnumWithFalseDoesNotMatch0.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,7 +30,7 @@ class TestEnumWithFalseDoesNotMatch0(unittest.TestCase):
def test_float_zero_is_invalid_fails(self): def test_float_zero_is_invalid_fails(self):
# float zero is invalid # float zero is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWithFalseDoesNotMatch0._from_openapi_data( EnumWithFalseDoesNotMatch0.from_openapi_data_oapg(
0.0, 0.0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -38,7 +38,7 @@ class TestEnumWithFalseDoesNotMatch0(unittest.TestCase):
def test_integer_zero_is_invalid_fails(self): def test_integer_zero_is_invalid_fails(self):
# integer zero is invalid # integer zero is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWithFalseDoesNotMatch0._from_openapi_data( EnumWithFalseDoesNotMatch0.from_openapi_data_oapg(
0, 0,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestEnumWithTrueDoesNotMatch1(unittest.TestCase):
def test_float_one_is_invalid_fails(self): def test_float_one_is_invalid_fails(self):
# float one is invalid # float one is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWithTrueDoesNotMatch1._from_openapi_data( EnumWithTrueDoesNotMatch1.from_openapi_data_oapg(
1.0, 1.0,
_configuration=self._configuration _configuration=self._configuration
) )
def test_true_is_valid_passes(self): def test_true_is_valid_passes(self):
# true is valid # true is valid
EnumWithTrueDoesNotMatch1._from_openapi_data( EnumWithTrueDoesNotMatch1.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
@ -38,7 +38,7 @@ class TestEnumWithTrueDoesNotMatch1(unittest.TestCase):
def test_integer_one_is_invalid_fails(self): def test_integer_one_is_invalid_fails(self):
# integer one is invalid # integer one is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumWithTrueDoesNotMatch1._from_openapi_data( EnumWithTrueDoesNotMatch1.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestEnumsInProperties(unittest.TestCase):
def test_missing_optional_property_is_valid_passes(self): def test_missing_optional_property_is_valid_passes(self):
# missing optional property is valid # missing optional property is valid
EnumsInProperties._from_openapi_data( EnumsInProperties.from_openapi_data_oapg(
{ {
"bar": "bar":
"bar", "bar",
@ -33,7 +33,7 @@ class TestEnumsInProperties(unittest.TestCase):
def test_wrong_foo_value_fails(self): def test_wrong_foo_value_fails(self):
# wrong foo value # wrong foo value
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumsInProperties._from_openapi_data( EnumsInProperties.from_openapi_data_oapg(
{ {
"foo": "foo":
"foot", "foot",
@ -45,7 +45,7 @@ class TestEnumsInProperties(unittest.TestCase):
def test_both_properties_are_valid_passes(self): def test_both_properties_are_valid_passes(self):
# both properties are valid # both properties are valid
EnumsInProperties._from_openapi_data( EnumsInProperties.from_openapi_data_oapg(
{ {
"foo": "foo":
"foo", "foo",
@ -58,7 +58,7 @@ class TestEnumsInProperties(unittest.TestCase):
def test_wrong_bar_value_fails(self): def test_wrong_bar_value_fails(self):
# wrong bar value # wrong bar value
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumsInProperties._from_openapi_data( EnumsInProperties.from_openapi_data_oapg(
{ {
"foo": "foo":
"foo", "foo",
@ -71,7 +71,7 @@ class TestEnumsInProperties(unittest.TestCase):
def test_missing_all_properties_is_invalid_fails(self): def test_missing_all_properties_is_invalid_fails(self):
# missing all properties is invalid # missing all properties is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumsInProperties._from_openapi_data( EnumsInProperties.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -80,7 +80,7 @@ class TestEnumsInProperties(unittest.TestCase):
def test_missing_required_property_is_invalid_fails(self): def test_missing_required_property_is_invalid_fails(self):
# missing required property is invalid # missing required property is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
EnumsInProperties._from_openapi_data( EnumsInProperties.from_openapi_data_oapg(
{ {
"foo": "foo":
"foo", "foo",

View File

@ -23,7 +23,7 @@ class TestForbiddenProperty(unittest.TestCase):
def test_property_present_fails(self): def test_property_present_fails(self):
# property present # property present
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ForbiddenProperty._from_openapi_data( ForbiddenProperty.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -35,7 +35,7 @@ class TestForbiddenProperty(unittest.TestCase):
def test_property_absent_passes(self): def test_property_absent_passes(self):
# property absent # property absent
ForbiddenProperty._from_openapi_data( ForbiddenProperty.from_openapi_data_oapg(
{ {
"bar": "bar":
1, 1,

View File

@ -22,7 +22,7 @@ class TestHostnameFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
HostnameFormat._from_openapi_data( HostnameFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestHostnameFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
HostnameFormat._from_openapi_data( HostnameFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
HostnameFormat._from_openapi_data( HostnameFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
HostnameFormat._from_openapi_data( HostnameFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
HostnameFormat._from_openapi_data( HostnameFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestHostnameFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
HostnameFormat._from_openapi_data( HostnameFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_an_object_is_not_an_integer_fails(self): def test_an_object_is_not_an_integer_fails(self):
# an object is not an integer # an object is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -32,7 +32,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_string_is_not_an_integer_fails(self): def test_a_string_is_not_an_integer_fails(self):
# a string is not an integer # a string is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
@ -40,14 +40,14 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_null_is_not_an_integer_fails(self): def test_null_is_not_an_integer_fails(self):
# null is not an integer # null is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
def test_a_float_with_zero_fractional_part_is_an_integer_passes(self): def test_a_float_with_zero_fractional_part_is_an_integer_passes(self):
# a float with zero fractional part is an integer # a float with zero fractional part is an integer
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
1.0, 1.0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -55,7 +55,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_float_is_not_an_integer_fails(self): def test_a_float_is_not_an_integer_fails(self):
# a float is not an integer # a float is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -63,14 +63,14 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_boolean_is_not_an_integer_fails(self): def test_a_boolean_is_not_an_integer_fails(self):
# a boolean is not an integer # a boolean is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
def test_an_integer_is_an_integer_passes(self): def test_an_integer_is_an_integer_passes(self):
# an integer is an integer # an integer is an integer
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -78,7 +78,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_string_is_still_not_an_integer_even_if_it_looks_like_one_fails(self): def test_a_string_is_still_not_an_integer_even_if_it_looks_like_one_fails(self):
# a string is still not an integer, even if it looks like one # a string is still not an integer, even if it looks like one
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
"1", "1",
_configuration=self._configuration _configuration=self._configuration
) )
@ -86,7 +86,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_an_array_is_not_an_integer_fails(self): def test_an_array_is_not_an_integer_fails(self):
# an array is not an integer # an array is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data( IntegerTypeMatchesIntegers.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration

View File

@ -23,14 +23,14 @@ class TestInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf(unittest.TestCa
def test_always_invalid_but_naive_implementations_may_raise_an_overflow_error_fails(self): def test_always_invalid_but_naive_implementations_may_raise_an_overflow_error_fails(self):
# always invalid, but naive implementations may raise an overflow error # always invalid, but naive implementations may raise an overflow error
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data( InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.from_openapi_data_oapg(
1.0E308, 1.0E308,
_configuration=self._configuration _configuration=self._configuration
) )
def test_valid_integer_with_multipleof_float_passes(self): def test_valid_integer_with_multipleof_float_passes(self):
# valid integer with multipleOf float # valid integer with multipleOf float
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data( InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.from_openapi_data_oapg(
123456789, 123456789,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestInvalidStringValueForDefault(unittest.TestCase):
def test_valid_when_property_is_specified_passes(self): def test_valid_when_property_is_specified_passes(self):
# valid when property is specified # valid when property is specified
InvalidStringValueForDefault._from_openapi_data( InvalidStringValueForDefault.from_openapi_data_oapg(
{ {
"bar": "bar":
"good", "good",
@ -32,7 +32,7 @@ class TestInvalidStringValueForDefault(unittest.TestCase):
def test_still_valid_when_the_invalid_default_is_used_passes(self): def test_still_valid_when_the_invalid_default_is_used_passes(self):
# still valid when the invalid default is used # still valid when the invalid default is used
InvalidStringValueForDefault._from_openapi_data( InvalidStringValueForDefault.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration

View File

@ -22,7 +22,7 @@ class TestIpv4Format(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
Ipv4Format._from_openapi_data( Ipv4Format.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestIpv4Format(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
Ipv4Format._from_openapi_data( Ipv4Format.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
Ipv4Format._from_openapi_data( Ipv4Format.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
Ipv4Format._from_openapi_data( Ipv4Format.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
Ipv4Format._from_openapi_data( Ipv4Format.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestIpv4Format(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
Ipv4Format._from_openapi_data( Ipv4Format.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestIpv6Format(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
Ipv6Format._from_openapi_data( Ipv6Format.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestIpv6Format(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
Ipv6Format._from_openapi_data( Ipv6Format.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
Ipv6Format._from_openapi_data( Ipv6Format.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
Ipv6Format._from_openapi_data( Ipv6Format.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
Ipv6Format._from_openapi_data( Ipv6Format.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestIpv6Format(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
Ipv6Format._from_openapi_data( Ipv6Format.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestJsonPointerFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
JsonPointerFormat._from_openapi_data( JsonPointerFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestJsonPointerFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
JsonPointerFormat._from_openapi_data( JsonPointerFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
JsonPointerFormat._from_openapi_data( JsonPointerFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
JsonPointerFormat._from_openapi_data( JsonPointerFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
JsonPointerFormat._from_openapi_data( JsonPointerFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestJsonPointerFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
JsonPointerFormat._from_openapi_data( JsonPointerFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,14 +22,14 @@ class TestMaximumValidation(unittest.TestCase):
def test_below_the_maximum_is_valid_passes(self): def test_below_the_maximum_is_valid_passes(self):
# below the maximum is valid # below the maximum is valid
MaximumValidation._from_openapi_data( MaximumValidation.from_openapi_data_oapg(
2.6, 2.6,
_configuration=self._configuration _configuration=self._configuration
) )
def test_boundary_point_is_valid_passes(self): def test_boundary_point_is_valid_passes(self):
# boundary point is valid # boundary point is valid
MaximumValidation._from_openapi_data( MaximumValidation.from_openapi_data_oapg(
3.0, 3.0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -37,14 +37,14 @@ class TestMaximumValidation(unittest.TestCase):
def test_above_the_maximum_is_invalid_fails(self): def test_above_the_maximum_is_invalid_fails(self):
# above the maximum is invalid # above the maximum is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MaximumValidation._from_openapi_data( MaximumValidation.from_openapi_data_oapg(
3.5, 3.5,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_non_numbers_passes(self): def test_ignores_non_numbers_passes(self):
# ignores non-numbers # ignores non-numbers
MaximumValidation._from_openapi_data( MaximumValidation.from_openapi_data_oapg(
"x", "x",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestMaximumValidationWithUnsignedInteger(unittest.TestCase):
def test_below_the_maximum_is_invalid_passes(self): def test_below_the_maximum_is_invalid_passes(self):
# below the maximum is invalid # below the maximum is invalid
MaximumValidationWithUnsignedInteger._from_openapi_data( MaximumValidationWithUnsignedInteger.from_openapi_data_oapg(
299.97, 299.97,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,21 +30,21 @@ class TestMaximumValidationWithUnsignedInteger(unittest.TestCase):
def test_above_the_maximum_is_invalid_fails(self): def test_above_the_maximum_is_invalid_fails(self):
# above the maximum is invalid # above the maximum is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MaximumValidationWithUnsignedInteger._from_openapi_data( MaximumValidationWithUnsignedInteger.from_openapi_data_oapg(
300.5, 300.5,
_configuration=self._configuration _configuration=self._configuration
) )
def test_boundary_point_integer_is_valid_passes(self): def test_boundary_point_integer_is_valid_passes(self):
# boundary point integer is valid # boundary point integer is valid
MaximumValidationWithUnsignedInteger._from_openapi_data( MaximumValidationWithUnsignedInteger.from_openapi_data_oapg(
300, 300,
_configuration=self._configuration _configuration=self._configuration
) )
def test_boundary_point_float_is_valid_passes(self): def test_boundary_point_float_is_valid_passes(self):
# boundary point float is valid # boundary point float is valid
MaximumValidationWithUnsignedInteger._from_openapi_data( MaximumValidationWithUnsignedInteger.from_openapi_data_oapg(
300.0, 300.0,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestMaxitemsValidation(unittest.TestCase):
def test_too_long_is_invalid_fails(self): def test_too_long_is_invalid_fails(self):
# too long is invalid # too long is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MaxitemsValidation._from_openapi_data( MaxitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,
@ -34,14 +34,14 @@ class TestMaxitemsValidation(unittest.TestCase):
def test_ignores_non_arrays_passes(self): def test_ignores_non_arrays_passes(self):
# ignores non-arrays # ignores non-arrays
MaxitemsValidation._from_openapi_data( MaxitemsValidation.from_openapi_data_oapg(
"foobar", "foobar",
_configuration=self._configuration _configuration=self._configuration
) )
def test_shorter_is_valid_passes(self): def test_shorter_is_valid_passes(self):
# shorter is valid # shorter is valid
MaxitemsValidation._from_openapi_data( MaxitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
], ],
@ -50,7 +50,7 @@ class TestMaxitemsValidation(unittest.TestCase):
def test_exact_length_is_valid_passes(self): def test_exact_length_is_valid_passes(self):
# exact length is valid # exact length is valid
MaxitemsValidation._from_openapi_data( MaxitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,

View File

@ -23,35 +23,35 @@ class TestMaxlengthValidation(unittest.TestCase):
def test_too_long_is_invalid_fails(self): def test_too_long_is_invalid_fails(self):
# too long is invalid # too long is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MaxlengthValidation._from_openapi_data( MaxlengthValidation.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_non_strings_passes(self): def test_ignores_non_strings_passes(self):
# ignores non-strings # ignores non-strings
MaxlengthValidation._from_openapi_data( MaxlengthValidation.from_openapi_data_oapg(
100, 100,
_configuration=self._configuration _configuration=self._configuration
) )
def test_shorter_is_valid_passes(self): def test_shorter_is_valid_passes(self):
# shorter is valid # shorter is valid
MaxlengthValidation._from_openapi_data( MaxlengthValidation.from_openapi_data_oapg(
"f", "f",
_configuration=self._configuration _configuration=self._configuration
) )
def test_two_supplementary_unicode_code_points_is_long_enough_passes(self): def test_two_supplementary_unicode_code_points_is_long_enough_passes(self):
# two supplementary Unicode code points is long enough # two supplementary Unicode code points is long enough
MaxlengthValidation._from_openapi_data( MaxlengthValidation.from_openapi_data_oapg(
"💩💩", "💩💩",
_configuration=self._configuration _configuration=self._configuration
) )
def test_exact_length_is_valid_passes(self): def test_exact_length_is_valid_passes(self):
# exact length is valid # exact length is valid
MaxlengthValidation._from_openapi_data( MaxlengthValidation.from_openapi_data_oapg(
"fo", "fo",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestMaxproperties0MeansTheObjectIsEmpty(unittest.TestCase):
def test_no_properties_is_valid_passes(self): def test_no_properties_is_valid_passes(self):
# no properties is valid # no properties is valid
Maxproperties0MeansTheObjectIsEmpty._from_openapi_data( Maxproperties0MeansTheObjectIsEmpty.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -31,7 +31,7 @@ class TestMaxproperties0MeansTheObjectIsEmpty(unittest.TestCase):
def test_one_property_is_invalid_fails(self): def test_one_property_is_invalid_fails(self):
# one property is invalid # one property is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Maxproperties0MeansTheObjectIsEmpty._from_openapi_data( Maxproperties0MeansTheObjectIsEmpty.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,

View File

@ -23,7 +23,7 @@ class TestMaxpropertiesValidation(unittest.TestCase):
def test_too_long_is_invalid_fails(self): def test_too_long_is_invalid_fails(self):
# too long is invalid # too long is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MaxpropertiesValidation._from_openapi_data( MaxpropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -37,7 +37,7 @@ class TestMaxpropertiesValidation(unittest.TestCase):
def test_ignores_arrays_passes(self): def test_ignores_arrays_passes(self):
# ignores arrays # ignores arrays
MaxpropertiesValidation._from_openapi_data( MaxpropertiesValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,
@ -48,21 +48,21 @@ class TestMaxpropertiesValidation(unittest.TestCase):
def test_ignores_other_non_objects_passes(self): def test_ignores_other_non_objects_passes(self):
# ignores other non-objects # ignores other non-objects
MaxpropertiesValidation._from_openapi_data( MaxpropertiesValidation.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_strings_passes(self): def test_ignores_strings_passes(self):
# ignores strings # ignores strings
MaxpropertiesValidation._from_openapi_data( MaxpropertiesValidation.from_openapi_data_oapg(
"foobar", "foobar",
_configuration=self._configuration _configuration=self._configuration
) )
def test_shorter_is_valid_passes(self): def test_shorter_is_valid_passes(self):
# shorter is valid # shorter is valid
MaxpropertiesValidation._from_openapi_data( MaxpropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -72,7 +72,7 @@ class TestMaxpropertiesValidation(unittest.TestCase):
def test_exact_length_is_valid_passes(self): def test_exact_length_is_valid_passes(self):
# exact length is valid # exact length is valid
MaxpropertiesValidation._from_openapi_data( MaxpropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,

View File

@ -22,7 +22,7 @@ class TestMinimumValidation(unittest.TestCase):
def test_boundary_point_is_valid_passes(self): def test_boundary_point_is_valid_passes(self):
# boundary point is valid # boundary point is valid
MinimumValidation._from_openapi_data( MinimumValidation.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,21 +30,21 @@ class TestMinimumValidation(unittest.TestCase):
def test_below_the_minimum_is_invalid_fails(self): def test_below_the_minimum_is_invalid_fails(self):
# below the minimum is invalid # below the minimum is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinimumValidation._from_openapi_data( MinimumValidation.from_openapi_data_oapg(
0.6, 0.6,
_configuration=self._configuration _configuration=self._configuration
) )
def test_above_the_minimum_is_valid_passes(self): def test_above_the_minimum_is_valid_passes(self):
# above the minimum is valid # above the minimum is valid
MinimumValidation._from_openapi_data( MinimumValidation.from_openapi_data_oapg(
2.6, 2.6,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_non_numbers_passes(self): def test_ignores_non_numbers_passes(self):
# ignores non-numbers # ignores non-numbers
MinimumValidation._from_openapi_data( MinimumValidation.from_openapi_data_oapg(
"x", "x",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,14 +22,14 @@ class TestMinimumValidationWithSignedInteger(unittest.TestCase):
def test_boundary_point_is_valid_passes(self): def test_boundary_point_is_valid_passes(self):
# boundary point is valid # boundary point is valid
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
-2, -2,
_configuration=self._configuration _configuration=self._configuration
) )
def test_positive_above_the_minimum_is_valid_passes(self): def test_positive_above_the_minimum_is_valid_passes(self):
# positive above the minimum is valid # positive above the minimum is valid
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
0, 0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -37,7 +37,7 @@ class TestMinimumValidationWithSignedInteger(unittest.TestCase):
def test_int_below_the_minimum_is_invalid_fails(self): def test_int_below_the_minimum_is_invalid_fails(self):
# int below the minimum is invalid # int below the minimum is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
-3, -3,
_configuration=self._configuration _configuration=self._configuration
) )
@ -45,28 +45,28 @@ class TestMinimumValidationWithSignedInteger(unittest.TestCase):
def test_float_below_the_minimum_is_invalid_fails(self): def test_float_below_the_minimum_is_invalid_fails(self):
# float below the minimum is invalid # float below the minimum is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
-2.0001, -2.0001,
_configuration=self._configuration _configuration=self._configuration
) )
def test_boundary_point_with_float_is_valid_passes(self): def test_boundary_point_with_float_is_valid_passes(self):
# boundary point with float is valid # boundary point with float is valid
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
-2.0, -2.0,
_configuration=self._configuration _configuration=self._configuration
) )
def test_negative_above_the_minimum_is_valid_passes(self): def test_negative_above_the_minimum_is_valid_passes(self):
# negative above the minimum is valid # negative above the minimum is valid
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
-1, -1,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_non_numbers_passes(self): def test_ignores_non_numbers_passes(self):
# ignores non-numbers # ignores non-numbers
MinimumValidationWithSignedInteger._from_openapi_data( MinimumValidationWithSignedInteger.from_openapi_data_oapg(
"x", "x",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestMinitemsValidation(unittest.TestCase):
def test_too_short_is_invalid_fails(self): def test_too_short_is_invalid_fails(self):
# too short is invalid # too short is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinitemsValidation._from_openapi_data( MinitemsValidation.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -31,14 +31,14 @@ class TestMinitemsValidation(unittest.TestCase):
def test_ignores_non_arrays_passes(self): def test_ignores_non_arrays_passes(self):
# ignores non-arrays # ignores non-arrays
MinitemsValidation._from_openapi_data( MinitemsValidation.from_openapi_data_oapg(
"", "",
_configuration=self._configuration _configuration=self._configuration
) )
def test_longer_is_valid_passes(self): def test_longer_is_valid_passes(self):
# longer is valid # longer is valid
MinitemsValidation._from_openapi_data( MinitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,
@ -48,7 +48,7 @@ class TestMinitemsValidation(unittest.TestCase):
def test_exact_length_is_valid_passes(self): def test_exact_length_is_valid_passes(self):
# exact length is valid # exact length is valid
MinitemsValidation._from_openapi_data( MinitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
], ],

View File

@ -23,7 +23,7 @@ class TestMinlengthValidation(unittest.TestCase):
def test_too_short_is_invalid_fails(self): def test_too_short_is_invalid_fails(self):
# too short is invalid # too short is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinlengthValidation._from_openapi_data( MinlengthValidation.from_openapi_data_oapg(
"f", "f",
_configuration=self._configuration _configuration=self._configuration
) )
@ -31,28 +31,28 @@ class TestMinlengthValidation(unittest.TestCase):
def test_one_supplementary_unicode_code_point_is_not_long_enough_fails(self): def test_one_supplementary_unicode_code_point_is_not_long_enough_fails(self):
# one supplementary Unicode code point is not long enough # one supplementary Unicode code point is not long enough
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinlengthValidation._from_openapi_data( MinlengthValidation.from_openapi_data_oapg(
"💩", "💩",
_configuration=self._configuration _configuration=self._configuration
) )
def test_longer_is_valid_passes(self): def test_longer_is_valid_passes(self):
# longer is valid # longer is valid
MinlengthValidation._from_openapi_data( MinlengthValidation.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_non_strings_passes(self): def test_ignores_non_strings_passes(self):
# ignores non-strings # ignores non-strings
MinlengthValidation._from_openapi_data( MinlengthValidation.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
def test_exact_length_is_valid_passes(self): def test_exact_length_is_valid_passes(self):
# exact length is valid # exact length is valid
MinlengthValidation._from_openapi_data( MinlengthValidation.from_openapi_data_oapg(
"fo", "fo",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestMinpropertiesValidation(unittest.TestCase):
def test_ignores_arrays_passes(self): def test_ignores_arrays_passes(self):
# ignores arrays # ignores arrays
MinpropertiesValidation._from_openapi_data( MinpropertiesValidation.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -30,7 +30,7 @@ class TestMinpropertiesValidation(unittest.TestCase):
def test_ignores_other_non_objects_passes(self): def test_ignores_other_non_objects_passes(self):
# ignores other non-objects # ignores other non-objects
MinpropertiesValidation._from_openapi_data( MinpropertiesValidation.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
@ -38,7 +38,7 @@ class TestMinpropertiesValidation(unittest.TestCase):
def test_too_short_is_invalid_fails(self): def test_too_short_is_invalid_fails(self):
# too short is invalid # too short is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
MinpropertiesValidation._from_openapi_data( MinpropertiesValidation.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -46,14 +46,14 @@ class TestMinpropertiesValidation(unittest.TestCase):
def test_ignores_strings_passes(self): def test_ignores_strings_passes(self):
# ignores strings # ignores strings
MinpropertiesValidation._from_openapi_data( MinpropertiesValidation.from_openapi_data_oapg(
"", "",
_configuration=self._configuration _configuration=self._configuration
) )
def test_longer_is_valid_passes(self): def test_longer_is_valid_passes(self):
# longer is valid # longer is valid
MinpropertiesValidation._from_openapi_data( MinpropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -65,7 +65,7 @@ class TestMinpropertiesValidation(unittest.TestCase):
def test_exact_length_is_valid_passes(self): def test_exact_length_is_valid_passes(self):
# exact length is valid # exact length is valid
MinpropertiesValidation._from_openapi_data( MinpropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,

View File

@ -22,7 +22,7 @@ class TestModelNot(unittest.TestCase):
def test_allowed_passes(self): def test_allowed_passes(self):
# allowed # allowed
ModelNot._from_openapi_data( ModelNot.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,7 +30,7 @@ class TestModelNot(unittest.TestCase):
def test_disallowed_fails(self): def test_disallowed_fails(self):
# disallowed # disallowed
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ModelNot._from_openapi_data( ModelNot.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestNestedAllofToCheckValidationSemantics(unittest.TestCase):
def test_anything_non_null_is_invalid_fails(self): def test_anything_non_null_is_invalid_fails(self):
# anything non-null is invalid # anything non-null is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NestedAllofToCheckValidationSemantics._from_openapi_data( NestedAllofToCheckValidationSemantics.from_openapi_data_oapg(
123, 123,
_configuration=self._configuration _configuration=self._configuration
) )
def test_null_is_valid_passes(self): def test_null_is_valid_passes(self):
# null is valid # null is valid
NestedAllofToCheckValidationSemantics._from_openapi_data( NestedAllofToCheckValidationSemantics.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestNestedAnyofToCheckValidationSemantics(unittest.TestCase):
def test_anything_non_null_is_invalid_fails(self): def test_anything_non_null_is_invalid_fails(self):
# anything non-null is invalid # anything non-null is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NestedAnyofToCheckValidationSemantics._from_openapi_data( NestedAnyofToCheckValidationSemantics.from_openapi_data_oapg(
123, 123,
_configuration=self._configuration _configuration=self._configuration
) )
def test_null_is_valid_passes(self): def test_null_is_valid_passes(self):
# null is valid # null is valid
NestedAnyofToCheckValidationSemantics._from_openapi_data( NestedAnyofToCheckValidationSemantics.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestNestedItems(unittest.TestCase):
def test_valid_nested_array_passes(self): def test_valid_nested_array_passes(self):
# valid nested array # valid nested array
NestedItems._from_openapi_data( NestedItems.from_openapi_data_oapg(
[ [
[ [
[ [
@ -59,7 +59,7 @@ class TestNestedItems(unittest.TestCase):
def test_nested_array_with_invalid_type_fails(self): def test_nested_array_with_invalid_type_fails(self):
# nested array with invalid type # nested array with invalid type
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NestedItems._from_openapi_data( NestedItems.from_openapi_data_oapg(
[ [
[ [
[ [
@ -96,7 +96,7 @@ class TestNestedItems(unittest.TestCase):
def test_not_deep_enough_fails(self): def test_not_deep_enough_fails(self):
# not deep enough # not deep enough
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NestedItems._from_openapi_data( NestedItems.from_openapi_data_oapg(
[ [
[ [
[ [

View File

@ -23,14 +23,14 @@ class TestNestedOneofToCheckValidationSemantics(unittest.TestCase):
def test_anything_non_null_is_invalid_fails(self): def test_anything_non_null_is_invalid_fails(self):
# anything non-null is invalid # anything non-null is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NestedOneofToCheckValidationSemantics._from_openapi_data( NestedOneofToCheckValidationSemantics.from_openapi_data_oapg(
123, 123,
_configuration=self._configuration _configuration=self._configuration
) )
def test_null_is_valid_passes(self): def test_null_is_valid_passes(self):
# null is valid # null is valid
NestedOneofToCheckValidationSemantics._from_openapi_data( NestedOneofToCheckValidationSemantics.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestNotMoreComplexSchema(unittest.TestCase):
def test_other_match_passes(self): def test_other_match_passes(self):
# other match # other match
NotMoreComplexSchema._from_openapi_data( NotMoreComplexSchema.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -33,7 +33,7 @@ class TestNotMoreComplexSchema(unittest.TestCase):
def test_mismatch_fails(self): def test_mismatch_fails(self):
# mismatch # mismatch
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NotMoreComplexSchema._from_openapi_data( NotMoreComplexSchema.from_openapi_data_oapg(
{ {
"foo": "foo":
"bar", "bar",
@ -43,7 +43,7 @@ class TestNotMoreComplexSchema(unittest.TestCase):
def test_match_passes(self): def test_match_passes(self):
# match # match
NotMoreComplexSchema._from_openapi_data( NotMoreComplexSchema.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestNulCharactersInStrings(unittest.TestCase):
def test_match_string_with_nul_passes(self): def test_match_string_with_nul_passes(self):
# match string with nul # match string with nul
NulCharactersInStrings._from_openapi_data( NulCharactersInStrings.from_openapi_data_oapg(
"hello\x00there", "hello\x00there",
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,7 +30,7 @@ class TestNulCharactersInStrings(unittest.TestCase):
def test_do_not_match_string_lacking_nul_fails(self): def test_do_not_match_string_lacking_nul_fails(self):
# do not match string lacking nul # do not match string lacking nul
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NulCharactersInStrings._from_openapi_data( NulCharactersInStrings.from_openapi_data_oapg(
"hellothere", "hellothere",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_a_float_is_not_null_fails(self): def test_a_float_is_not_null_fails(self):
# a float is not null # a float is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -31,7 +31,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_an_object_is_not_null_fails(self): def test_an_object_is_not_null_fails(self):
# an object is not null # an object is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -40,7 +40,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_false_is_not_null_fails(self): def test_false_is_not_null_fails(self):
# false is not null # false is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
@ -48,7 +48,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_an_integer_is_not_null_fails(self): def test_an_integer_is_not_null_fails(self):
# an integer is not null # an integer is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -56,7 +56,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_true_is_not_null_fails(self): def test_true_is_not_null_fails(self):
# true is not null # true is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
@ -64,7 +64,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_zero_is_not_null_fails(self): def test_zero_is_not_null_fails(self):
# zero is not null # zero is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
0, 0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -72,14 +72,14 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_an_empty_string_is_not_null_fails(self): def test_an_empty_string_is_not_null_fails(self):
# an empty string is not null # an empty string is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
"", "",
_configuration=self._configuration _configuration=self._configuration
) )
def test_null_is_null_passes(self): def test_null_is_null_passes(self):
# null is null # null is null
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
@ -87,7 +87,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_an_array_is_not_null_fails(self): def test_an_array_is_not_null_fails(self):
# an array is not null # an array is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -96,7 +96,7 @@ class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
def test_a_string_is_not_null_fails(self): def test_a_string_is_not_null_fails(self):
# a string is not null # a string is not null
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NullTypeMatchesOnlyTheNullObject._from_openapi_data( NullTypeMatchesOnlyTheNullObject.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestNumberTypeMatchesNumbers(unittest.TestCase):
def test_an_array_is_not_a_number_fails(self): def test_an_array_is_not_a_number_fails(self):
# an array is not a number # an array is not a number
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -32,7 +32,7 @@ class TestNumberTypeMatchesNumbers(unittest.TestCase):
def test_null_is_not_a_number_fails(self): def test_null_is_not_a_number_fails(self):
# null is not a number # null is not a number
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
@ -40,7 +40,7 @@ class TestNumberTypeMatchesNumbers(unittest.TestCase):
def test_an_object_is_not_a_number_fails(self): def test_an_object_is_not_a_number_fails(self):
# an object is not a number # an object is not a number
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -49,14 +49,14 @@ class TestNumberTypeMatchesNumbers(unittest.TestCase):
def test_a_boolean_is_not_a_number_fails(self): def test_a_boolean_is_not_a_number_fails(self):
# a boolean is not a number # a boolean is not a number
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
def test_a_float_is_a_number_passes(self): def test_a_float_is_a_number_passes(self):
# a float is a number # a float is a number
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -64,7 +64,7 @@ class TestNumberTypeMatchesNumbers(unittest.TestCase):
def test_a_string_is_still_not_a_number_even_if_it_looks_like_one_fails(self): def test_a_string_is_still_not_a_number_even_if_it_looks_like_one_fails(self):
# a string is still not a number, even if it looks like one # a string is still not a number, even if it looks like one
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
"1", "1",
_configuration=self._configuration _configuration=self._configuration
) )
@ -72,21 +72,21 @@ class TestNumberTypeMatchesNumbers(unittest.TestCase):
def test_a_string_is_not_a_number_fails(self): def test_a_string_is_not_a_number_fails(self):
# a string is not a number # a string is not a number
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
def test_an_integer_is_a_number_passes(self): def test_an_integer_is_a_number_passes(self):
# an integer is a number # an integer is a number
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
def test_a_float_with_zero_fractional_part_is_a_number_and_an_integer_passes(self): def test_a_float_with_zero_fractional_part_is_a_number_and_an_integer_passes(self):
# a float with zero fractional part is a number (and an integer) # a float with zero fractional part is a number (and an integer)
NumberTypeMatchesNumbers._from_openapi_data( NumberTypeMatchesNumbers.from_openapi_data_oapg(
1.0, 1.0,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestObjectPropertiesValidation(unittest.TestCase):
def test_ignores_arrays_passes(self): def test_ignores_arrays_passes(self):
# ignores arrays # ignores arrays
ObjectPropertiesValidation._from_openapi_data( ObjectPropertiesValidation.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -30,7 +30,7 @@ class TestObjectPropertiesValidation(unittest.TestCase):
def test_ignores_other_non_objects_passes(self): def test_ignores_other_non_objects_passes(self):
# ignores other non-objects # ignores other non-objects
ObjectPropertiesValidation._from_openapi_data( ObjectPropertiesValidation.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
@ -38,7 +38,7 @@ class TestObjectPropertiesValidation(unittest.TestCase):
def test_one_property_invalid_is_invalid_fails(self): def test_one_property_invalid_is_invalid_fails(self):
# one property invalid is invalid # one property invalid is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ObjectPropertiesValidation._from_openapi_data( ObjectPropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -51,7 +51,7 @@ class TestObjectPropertiesValidation(unittest.TestCase):
def test_both_properties_present_and_valid_is_valid_passes(self): def test_both_properties_present_and_valid_is_valid_passes(self):
# both properties present and valid is valid # both properties present and valid is valid
ObjectPropertiesValidation._from_openapi_data( ObjectPropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -63,7 +63,7 @@ class TestObjectPropertiesValidation(unittest.TestCase):
def test_doesn_t_invalidate_other_properties_passes(self): def test_doesn_t_invalidate_other_properties_passes(self):
# doesn't invalidate other properties # doesn't invalidate other properties
ObjectPropertiesValidation._from_openapi_data( ObjectPropertiesValidation.from_openapi_data_oapg(
{ {
"quux": "quux":
[ [
@ -75,7 +75,7 @@ class TestObjectPropertiesValidation(unittest.TestCase):
def test_both_properties_invalid_is_invalid_fails(self): def test_both_properties_invalid_is_invalid_fails(self):
# both properties invalid is invalid # both properties invalid is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
ObjectPropertiesValidation._from_openapi_data( ObjectPropertiesValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
[ [

View File

@ -22,7 +22,7 @@ class TestOneof(unittest.TestCase):
def test_second_oneof_valid_passes(self): def test_second_oneof_valid_passes(self):
# second oneOf valid # second oneOf valid
Oneof._from_openapi_data( Oneof.from_openapi_data_oapg(
2.5, 2.5,
_configuration=self._configuration _configuration=self._configuration
) )
@ -30,14 +30,14 @@ class TestOneof(unittest.TestCase):
def test_both_oneof_valid_fails(self): def test_both_oneof_valid_fails(self):
# both oneOf valid # both oneOf valid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Oneof._from_openapi_data( Oneof.from_openapi_data_oapg(
3, 3,
_configuration=self._configuration _configuration=self._configuration
) )
def test_first_oneof_valid_passes(self): def test_first_oneof_valid_passes(self):
# first oneOf valid # first oneOf valid
Oneof._from_openapi_data( Oneof.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -45,7 +45,7 @@ class TestOneof(unittest.TestCase):
def test_neither_oneof_valid_fails(self): def test_neither_oneof_valid_fails(self):
# neither oneOf valid # neither oneOf valid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
Oneof._from_openapi_data( Oneof.from_openapi_data_oapg(
1.5, 1.5,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestOneofComplexTypes(unittest.TestCase):
def test_first_oneof_valid_complex_passes(self): def test_first_oneof_valid_complex_passes(self):
# first oneOf valid (complex) # first oneOf valid (complex)
OneofComplexTypes._from_openapi_data( OneofComplexTypes.from_openapi_data_oapg(
{ {
"bar": "bar":
2, 2,
@ -33,7 +33,7 @@ class TestOneofComplexTypes(unittest.TestCase):
def test_neither_oneof_valid_complex_fails(self): def test_neither_oneof_valid_complex_fails(self):
# neither oneOf valid (complex) # neither oneOf valid (complex)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofComplexTypes._from_openapi_data( OneofComplexTypes.from_openapi_data_oapg(
{ {
"foo": "foo":
2, 2,
@ -46,7 +46,7 @@ class TestOneofComplexTypes(unittest.TestCase):
def test_both_oneof_valid_complex_fails(self): def test_both_oneof_valid_complex_fails(self):
# both oneOf valid (complex) # both oneOf valid (complex)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofComplexTypes._from_openapi_data( OneofComplexTypes.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",
@ -58,7 +58,7 @@ class TestOneofComplexTypes(unittest.TestCase):
def test_second_oneof_valid_complex_passes(self): def test_second_oneof_valid_complex_passes(self):
# second oneOf valid (complex) # second oneOf valid (complex)
OneofComplexTypes._from_openapi_data( OneofComplexTypes.from_openapi_data_oapg(
{ {
"foo": "foo":
"baz", "baz",

View File

@ -23,7 +23,7 @@ class TestOneofWithBaseSchema(unittest.TestCase):
def test_both_oneof_valid_fails(self): def test_both_oneof_valid_fails(self):
# both oneOf valid # both oneOf valid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofWithBaseSchema._from_openapi_data( OneofWithBaseSchema.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )
@ -31,14 +31,14 @@ class TestOneofWithBaseSchema(unittest.TestCase):
def test_mismatch_base_schema_fails(self): def test_mismatch_base_schema_fails(self):
# mismatch base schema # mismatch base schema
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofWithBaseSchema._from_openapi_data( OneofWithBaseSchema.from_openapi_data_oapg(
3, 3,
_configuration=self._configuration _configuration=self._configuration
) )
def test_one_oneof_valid_passes(self): def test_one_oneof_valid_passes(self):
# one oneOf valid # one oneOf valid
OneofWithBaseSchema._from_openapi_data( OneofWithBaseSchema.from_openapi_data_oapg(
"foobar", "foobar",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,14 +23,14 @@ class TestOneofWithEmptySchema(unittest.TestCase):
def test_both_valid_invalid_fails(self): def test_both_valid_invalid_fails(self):
# both valid - invalid # both valid - invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofWithEmptySchema._from_openapi_data( OneofWithEmptySchema.from_openapi_data_oapg(
123, 123,
_configuration=self._configuration _configuration=self._configuration
) )
def test_one_valid_valid_passes(self): def test_one_valid_valid_passes(self):
# one valid - valid # one valid - valid
OneofWithEmptySchema._from_openapi_data( OneofWithEmptySchema.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,7 +23,7 @@ class TestOneofWithRequired(unittest.TestCase):
def test_both_valid_invalid_fails(self): def test_both_valid_invalid_fails(self):
# both valid - invalid # both valid - invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofWithRequired._from_openapi_data( OneofWithRequired.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -38,7 +38,7 @@ class TestOneofWithRequired(unittest.TestCase):
def test_both_invalid_invalid_fails(self): def test_both_invalid_invalid_fails(self):
# both invalid - invalid # both invalid - invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
OneofWithRequired._from_openapi_data( OneofWithRequired.from_openapi_data_oapg(
{ {
"bar": "bar":
2, 2,
@ -48,7 +48,7 @@ class TestOneofWithRequired(unittest.TestCase):
def test_first_valid_valid_passes(self): def test_first_valid_valid_passes(self):
# first valid - valid # first valid - valid
OneofWithRequired._from_openapi_data( OneofWithRequired.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -60,7 +60,7 @@ class TestOneofWithRequired(unittest.TestCase):
def test_second_valid_valid_passes(self): def test_second_valid_valid_passes(self):
# second valid - valid # second valid - valid
OneofWithRequired._from_openapi_data( OneofWithRequired.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,

View File

@ -22,7 +22,7 @@ class TestPatternIsNotAnchored(unittest.TestCase):
def test_matches_a_substring_passes(self): def test_matches_a_substring_passes(self):
# matches a substring # matches a substring
PatternIsNotAnchored._from_openapi_data( PatternIsNotAnchored.from_openapi_data_oapg(
"xxaayy", "xxaayy",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestPatternValidation(unittest.TestCase):
def test_ignores_arrays_passes(self): def test_ignores_arrays_passes(self):
# ignores arrays # ignores arrays
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -30,7 +30,7 @@ class TestPatternValidation(unittest.TestCase):
def test_ignores_objects_passes(self): def test_ignores_objects_passes(self):
# ignores objects # ignores objects
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -38,14 +38,14 @@ class TestPatternValidation(unittest.TestCase):
def test_ignores_null_passes(self): def test_ignores_null_passes(self):
# ignores null # ignores null
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_floats_passes(self): def test_ignores_floats_passes(self):
# ignores floats # ignores floats
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
1.0, 1.0,
_configuration=self._configuration _configuration=self._configuration
) )
@ -53,28 +53,28 @@ class TestPatternValidation(unittest.TestCase):
def test_a_non_matching_pattern_is_invalid_fails(self): def test_a_non_matching_pattern_is_invalid_fails(self):
# a non-matching pattern is invalid # a non-matching pattern is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
"abc", "abc",
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_booleans_passes(self): def test_ignores_booleans_passes(self):
# ignores booleans # ignores booleans
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
def test_a_matching_pattern_is_valid_passes(self): def test_a_matching_pattern_is_valid_passes(self):
# a matching pattern is valid # a matching pattern is valid
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
"aaa", "aaa",
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_integers_passes(self): def test_ignores_integers_passes(self):
# ignores integers # ignores integers
PatternValidation._from_openapi_data( PatternValidation.from_openapi_data_oapg(
123, 123,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestPropertiesWithEscapedCharacters(unittest.TestCase):
def test_object_with_all_numbers_is_valid_passes(self): def test_object_with_all_numbers_is_valid_passes(self):
# object with all numbers is valid # object with all numbers is valid
PropertiesWithEscapedCharacters._from_openapi_data( PropertiesWithEscapedCharacters.from_openapi_data_oapg(
{ {
"foo\nbar": "foo\nbar":
1, 1,
@ -43,7 +43,7 @@ class TestPropertiesWithEscapedCharacters(unittest.TestCase):
def test_object_with_strings_is_invalid_fails(self): def test_object_with_strings_is_invalid_fails(self):
# object with strings is invalid # object with strings is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
PropertiesWithEscapedCharacters._from_openapi_data( PropertiesWithEscapedCharacters.from_openapi_data_oapg(
{ {
"foo\nbar": "foo\nbar":
"1", "1",

View File

@ -22,7 +22,7 @@ class TestPropertyNamedRefThatIsNotAReference(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
PropertyNamedRefThatIsNotAReference._from_openapi_data( PropertyNamedRefThatIsNotAReference.from_openapi_data_oapg(
{ {
"$ref": "$ref":
"a", "a",
@ -33,7 +33,7 @@ class TestPropertyNamedRefThatIsNotAReference(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
PropertyNamedRefThatIsNotAReference._from_openapi_data( PropertyNamedRefThatIsNotAReference.from_openapi_data_oapg(
{ {
"$ref": "$ref":
2, 2,

View File

@ -22,7 +22,7 @@ class TestRefInAdditionalproperties(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInAdditionalproperties._from_openapi_data( RefInAdditionalproperties.from_openapi_data_oapg(
{ {
"someProp": "someProp":
{ {
@ -36,7 +36,7 @@ class TestRefInAdditionalproperties(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInAdditionalproperties._from_openapi_data( RefInAdditionalproperties.from_openapi_data_oapg(
{ {
"someProp": "someProp":
{ {

View File

@ -22,7 +22,7 @@ class TestRefInAllof(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInAllof._from_openapi_data( RefInAllof.from_openapi_data_oapg(
{ {
"$ref": "$ref":
"a", "a",
@ -33,7 +33,7 @@ class TestRefInAllof(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInAllof._from_openapi_data( RefInAllof.from_openapi_data_oapg(
{ {
"$ref": "$ref":
2, 2,

View File

@ -22,7 +22,7 @@ class TestRefInAnyof(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInAnyof._from_openapi_data( RefInAnyof.from_openapi_data_oapg(
{ {
"$ref": "$ref":
"a", "a",
@ -33,7 +33,7 @@ class TestRefInAnyof(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInAnyof._from_openapi_data( RefInAnyof.from_openapi_data_oapg(
{ {
"$ref": "$ref":
2, 2,

View File

@ -22,7 +22,7 @@ class TestRefInItems(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInItems._from_openapi_data( RefInItems.from_openapi_data_oapg(
[ [
{ {
"$ref": "$ref":
@ -35,7 +35,7 @@ class TestRefInItems(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInItems._from_openapi_data( RefInItems.from_openapi_data_oapg(
[ [
{ {
"$ref": "$ref":

View File

@ -22,7 +22,7 @@ class TestRefInNot(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInNot._from_openapi_data( RefInNot.from_openapi_data_oapg(
{ {
"$ref": "$ref":
2, 2,
@ -33,7 +33,7 @@ class TestRefInNot(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInNot._from_openapi_data( RefInNot.from_openapi_data_oapg(
{ {
"$ref": "$ref":
"a", "a",

View File

@ -22,7 +22,7 @@ class TestRefInOneof(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInOneof._from_openapi_data( RefInOneof.from_openapi_data_oapg(
{ {
"$ref": "$ref":
"a", "a",
@ -33,7 +33,7 @@ class TestRefInOneof(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInOneof._from_openapi_data( RefInOneof.from_openapi_data_oapg(
{ {
"$ref": "$ref":
2, 2,

View File

@ -22,7 +22,7 @@ class TestRefInProperty(unittest.TestCase):
def test_property_named_ref_valid_passes(self): def test_property_named_ref_valid_passes(self):
# property named $ref valid # property named $ref valid
RefInProperty._from_openapi_data( RefInProperty.from_openapi_data_oapg(
{ {
"a": "a":
{ {
@ -36,7 +36,7 @@ class TestRefInProperty(unittest.TestCase):
def test_property_named_ref_invalid_fails(self): def test_property_named_ref_invalid_fails(self):
# property named $ref invalid # property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInProperty._from_openapi_data( RefInProperty.from_openapi_data_oapg(
{ {
"a": "a":
{ {

View File

@ -22,7 +22,7 @@ class TestRequiredDefaultValidation(unittest.TestCase):
def test_not_required_by_default_passes(self): def test_not_required_by_default_passes(self):
# not required by default # not required by default
RequiredDefaultValidation._from_openapi_data( RequiredDefaultValidation.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration

View File

@ -22,7 +22,7 @@ class TestRequiredValidation(unittest.TestCase):
def test_ignores_arrays_passes(self): def test_ignores_arrays_passes(self):
# ignores arrays # ignores arrays
RequiredValidation._from_openapi_data( RequiredValidation.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -30,7 +30,7 @@ class TestRequiredValidation(unittest.TestCase):
def test_present_required_property_is_valid_passes(self): def test_present_required_property_is_valid_passes(self):
# present required property is valid # present required property is valid
RequiredValidation._from_openapi_data( RequiredValidation.from_openapi_data_oapg(
{ {
"foo": "foo":
1, 1,
@ -40,14 +40,14 @@ class TestRequiredValidation(unittest.TestCase):
def test_ignores_other_non_objects_passes(self): def test_ignores_other_non_objects_passes(self):
# ignores other non-objects # ignores other non-objects
RequiredValidation._from_openapi_data( RequiredValidation.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_ignores_strings_passes(self): def test_ignores_strings_passes(self):
# ignores strings # ignores strings
RequiredValidation._from_openapi_data( RequiredValidation.from_openapi_data_oapg(
"", "",
_configuration=self._configuration _configuration=self._configuration
) )
@ -55,7 +55,7 @@ class TestRequiredValidation(unittest.TestCase):
def test_non_present_required_property_is_invalid_fails(self): def test_non_present_required_property_is_invalid_fails(self):
# non-present required property is invalid # non-present required property is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RequiredValidation._from_openapi_data( RequiredValidation.from_openapi_data_oapg(
{ {
"bar": "bar":
1, 1,

View File

@ -22,7 +22,7 @@ class TestRequiredWithEmptyArray(unittest.TestCase):
def test_property_not_required_passes(self): def test_property_not_required_passes(self):
# property not required # property not required
RequiredWithEmptyArray._from_openapi_data( RequiredWithEmptyArray.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration

View File

@ -23,7 +23,7 @@ class TestRequiredWithEscapedCharacters(unittest.TestCase):
def test_object_with_some_properties_missing_is_invalid_fails(self): def test_object_with_some_properties_missing_is_invalid_fails(self):
# object with some properties missing is invalid # object with some properties missing is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RequiredWithEscapedCharacters._from_openapi_data( RequiredWithEscapedCharacters.from_openapi_data_oapg(
{ {
"foo\nbar": "foo\nbar":
"1", "1",
@ -35,7 +35,7 @@ class TestRequiredWithEscapedCharacters(unittest.TestCase):
def test_object_with_all_properties_present_is_valid_passes(self): def test_object_with_all_properties_present_is_valid_passes(self):
# object with all properties present is valid # object with all properties present is valid
RequiredWithEscapedCharacters._from_openapi_data( RequiredWithEscapedCharacters.from_openapi_data_oapg(
{ {
"foo\nbar": "foo\nbar":
1, 1,

View File

@ -23,14 +23,14 @@ class TestSimpleEnumValidation(unittest.TestCase):
def test_something_else_is_invalid_fails(self): def test_something_else_is_invalid_fails(self):
# something else is invalid # something else is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
SimpleEnumValidation._from_openapi_data( SimpleEnumValidation.from_openapi_data_oapg(
4, 4,
_configuration=self._configuration _configuration=self._configuration
) )
def test_one_of_the_enum_is_valid_passes(self): def test_one_of_the_enum_is_valid_passes(self):
# one of the enum is valid # one of the enum is valid
SimpleEnumValidation._from_openapi_data( SimpleEnumValidation.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -23,21 +23,21 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_1_is_not_a_string_fails(self): def test_1_is_not_a_string_fails(self):
# 1 is not a string # 1 is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
1, 1,
_configuration=self._configuration _configuration=self._configuration
) )
def test_a_string_is_still_a_string_even_if_it_looks_like_a_number_passes(self): def test_a_string_is_still_a_string_even_if_it_looks_like_a_number_passes(self):
# a string is still a string, even if it looks like a number # a string is still a string, even if it looks like a number
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
"1", "1",
_configuration=self._configuration _configuration=self._configuration
) )
def test_an_empty_string_is_still_a_string_passes(self): def test_an_empty_string_is_still_a_string_passes(self):
# an empty string is still a string # an empty string is still a string
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
"", "",
_configuration=self._configuration _configuration=self._configuration
) )
@ -45,7 +45,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_a_float_is_not_a_string_fails(self): def test_a_float_is_not_a_string_fails(self):
# a float is not a string # a float is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
1.1, 1.1,
_configuration=self._configuration _configuration=self._configuration
) )
@ -53,7 +53,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_an_object_is_not_a_string_fails(self): def test_an_object_is_not_a_string_fails(self):
# an object is not a string # an object is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -62,7 +62,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_an_array_is_not_a_string_fails(self): def test_an_array_is_not_a_string_fails(self):
# an array is not a string # an array is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -71,7 +71,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_a_boolean_is_not_a_string_fails(self): def test_a_boolean_is_not_a_string_fails(self):
# a boolean is not a string # a boolean is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
True, True,
_configuration=self._configuration _configuration=self._configuration
) )
@ -79,14 +79,14 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_null_is_not_a_string_fails(self): def test_null_is_not_a_string_fails(self):
# null is not a string # null is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )
def test_a_string_is_a_string_passes(self): def test_a_string_is_a_string_passes(self):
# a string is a string # a string is a string
StringTypeMatchesStrings._from_openapi_data( StringTypeMatchesStrings.from_openapi_data_oapg(
"foo", "foo",
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing(unittest.Test
def test_missing_properties_are_not_filled_in_with_the_default_passes(self): def test_missing_properties_are_not_filled_in_with_the_default_passes(self):
# missing properties are not filled in with the default # missing properties are not filled in with the default
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data( TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,7 +30,7 @@ class TestTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing(unittest.Test
def test_an_explicit_property_value_is_checked_against_maximum_passing_passes(self): def test_an_explicit_property_value_is_checked_against_maximum_passing_passes(self):
# an explicit property value is checked against maximum (passing) # an explicit property value is checked against maximum (passing)
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data( TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.from_openapi_data_oapg(
{ {
"alpha": "alpha":
1, 1,
@ -41,7 +41,7 @@ class TestTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing(unittest.Test
def test_an_explicit_property_value_is_checked_against_maximum_failing_fails(self): def test_an_explicit_property_value_is_checked_against_maximum_failing_fails(self):
# an explicit property value is checked against maximum (failing) # an explicit property value is checked against maximum (failing)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data( TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.from_openapi_data_oapg(
{ {
"alpha": "alpha":
5, 5,

View File

@ -22,7 +22,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_integers_is_valid_passes(self): def test_non_unique_array_of_integers_is_valid_passes(self):
# non-unique array of integers is valid # non-unique array of integers is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
1, 1,
1, 1,
@ -32,7 +32,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_objects_is_valid_passes(self): def test_unique_array_of_objects_is_valid_passes(self):
# unique array of objects is valid # unique array of objects is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -48,7 +48,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_nested_objects_is_valid_passes(self): def test_non_unique_array_of_nested_objects_is_valid_passes(self):
# non-unique array of nested objects is valid # non-unique array of nested objects is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -76,7 +76,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_objects_is_valid_passes(self): def test_non_unique_array_of_objects_is_valid_passes(self):
# non-unique array of objects is valid # non-unique array of objects is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -92,7 +92,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_1_and_true_are_unique_passes(self): def test_1_and_true_are_unique_passes(self):
# 1 and true are unique # 1 and true are unique
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
1, 1,
True, True,
@ -102,7 +102,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_integers_is_valid_passes(self): def test_unique_array_of_integers_is_valid_passes(self):
# unique array of integers is valid # unique array of integers is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,
@ -112,7 +112,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_arrays_is_valid_passes(self): def test_non_unique_array_of_arrays_is_valid_passes(self):
# non-unique array of arrays is valid # non-unique array of arrays is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
[ [
"foo", "foo",
@ -126,7 +126,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_numbers_are_unique_if_mathematically_unequal_passes(self): def test_numbers_are_unique_if_mathematically_unequal_passes(self):
# numbers are unique if mathematically unequal # numbers are unique if mathematically unequal
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
1.0, 1.0,
1.0, 1.0,
@ -137,7 +137,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_false_is_not_equal_to_zero_passes(self): def test_false_is_not_equal_to_zero_passes(self):
# false is not equal to zero # false is not equal to zero
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
0, 0,
False, False,
@ -147,7 +147,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_nested_objects_is_valid_passes(self): def test_unique_array_of_nested_objects_is_valid_passes(self):
# unique array of nested objects is valid # unique array of nested objects is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -175,7 +175,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_0_and_false_are_unique_passes(self): def test_0_and_false_are_unique_passes(self):
# 0 and false are unique # 0 and false are unique
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
0, 0,
False, False,
@ -185,7 +185,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_arrays_is_valid_passes(self): def test_unique_array_of_arrays_is_valid_passes(self):
# unique array of arrays is valid # unique array of arrays is valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
[ [
"foo", "foo",
@ -199,7 +199,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_true_is_not_equal_to_one_passes(self): def test_true_is_not_equal_to_one_passes(self):
# true is not equal to one # true is not equal to one
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
1, 1,
True, True,
@ -209,7 +209,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_heterogeneous_types_are_valid_passes(self): def test_non_unique_heterogeneous_types_are_valid_passes(self):
# non-unique heterogeneous types are valid # non-unique heterogeneous types are valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
{ {
}, },
@ -227,7 +227,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_heterogeneous_types_are_valid_passes(self): def test_unique_heterogeneous_types_are_valid_passes(self):
# unique heterogeneous types are valid # unique heterogeneous types are valid
UniqueitemsFalseValidation._from_openapi_data( UniqueitemsFalseValidation.from_openapi_data_oapg(
[ [
{ {
}, },

View File

@ -22,7 +22,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_objects_is_valid_passes(self): def test_unique_array_of_objects_is_valid_passes(self):
# unique array of objects is valid # unique array of objects is valid
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -38,7 +38,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_a_true_and_a1_are_unique_passes(self): def test_a_true_and_a1_are_unique_passes(self):
# {"a": true} and {"a": 1} are unique # {"a": true} and {"a": 1} are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"a": "a":
@ -55,7 +55,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_heterogeneous_types_are_invalid_fails(self): def test_non_unique_heterogeneous_types_are_invalid_fails(self):
# non-unique heterogeneous types are invalid # non-unique heterogeneous types are invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
}, },
@ -73,7 +73,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_nested0_and_false_are_unique_passes(self): def test_nested0_and_false_are_unique_passes(self):
# nested [0] and [false] are unique # nested [0] and [false] are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
[ [
@ -93,7 +93,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_a_false_and_a0_are_unique_passes(self): def test_a_false_and_a0_are_unique_passes(self):
# {"a": false} and {"a": 0} are unique # {"a": false} and {"a": 0} are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"a": "a":
@ -110,7 +110,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_numbers_are_unique_if_mathematically_unequal_fails(self): def test_numbers_are_unique_if_mathematically_unequal_fails(self):
# numbers are unique if mathematically unequal # numbers are unique if mathematically unequal
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
1.0, 1.0,
1.0, 1.0,
@ -121,7 +121,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_false_is_not_equal_to_zero_passes(self): def test_false_is_not_equal_to_zero_passes(self):
# false is not equal to zero # false is not equal to zero
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
0, 0,
False, False,
@ -131,7 +131,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_0_and_false_are_unique_passes(self): def test_0_and_false_are_unique_passes(self):
# [0] and [false] are unique # [0] and [false] are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
0, 0,
@ -145,7 +145,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_arrays_is_valid_passes(self): def test_unique_array_of_arrays_is_valid_passes(self):
# unique array of arrays is valid # unique array of arrays is valid
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
"foo", "foo",
@ -160,7 +160,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_nested_objects_is_invalid_fails(self): def test_non_unique_array_of_nested_objects_is_invalid_fails(self):
# non-unique array of nested objects is invalid # non-unique array of nested objects is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -189,7 +189,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_more_than_two_integers_is_invalid_fails(self): def test_non_unique_array_of_more_than_two_integers_is_invalid_fails(self):
# non-unique array of more than two integers is invalid # non-unique array of more than two integers is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,
@ -200,7 +200,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_true_is_not_equal_to_one_passes(self): def test_true_is_not_equal_to_one_passes(self):
# true is not equal to one # true is not equal to one
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
True, True,
@ -211,7 +211,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_objects_are_non_unique_despite_key_order_fails(self): def test_objects_are_non_unique_despite_key_order_fails(self):
# objects are non-unique despite key order # objects are non-unique despite key order
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"a": "a":
@ -231,7 +231,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_strings_is_valid_passes(self): def test_unique_array_of_strings_is_valid_passes(self):
# unique array of strings is valid # unique array of strings is valid
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
"foo", "foo",
"bar", "bar",
@ -242,7 +242,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_1_and_true_are_unique_passes(self): def test_1_and_true_are_unique_passes(self):
# [1] and [true] are unique # [1] and [true] are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
1, 1,
@ -256,7 +256,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_different_objects_are_unique_passes(self): def test_different_objects_are_unique_passes(self):
# different objects are unique # different objects are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"a": "a":
@ -276,7 +276,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_integers_is_valid_passes(self): def test_unique_array_of_integers_is_valid_passes(self):
# unique array of integers is valid # unique array of integers is valid
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
2, 2,
@ -287,7 +287,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_more_than_two_arrays_is_invalid_fails(self): def test_non_unique_array_of_more_than_two_arrays_is_invalid_fails(self):
# non-unique array of more than two arrays is invalid # non-unique array of more than two arrays is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
"foo", "foo",
@ -305,7 +305,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_objects_is_invalid_fails(self): def test_non_unique_array_of_objects_is_invalid_fails(self):
# non-unique array of objects is invalid # non-unique array of objects is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -321,7 +321,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_nested_objects_is_valid_passes(self): def test_unique_array_of_nested_objects_is_valid_passes(self):
# unique array of nested objects is valid # unique array of nested objects is valid
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
"foo": "foo":
@ -350,7 +350,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_arrays_is_invalid_fails(self): def test_non_unique_array_of_arrays_is_invalid_fails(self):
# non-unique array of arrays is invalid # non-unique array of arrays is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
"foo", "foo",
@ -365,7 +365,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_strings_is_invalid_fails(self): def test_non_unique_array_of_strings_is_invalid_fails(self):
# non-unique array of strings is invalid # non-unique array of strings is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
"foo", "foo",
"bar", "bar",
@ -376,7 +376,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_nested1_and_true_are_unique_passes(self): def test_nested1_and_true_are_unique_passes(self):
# nested [1] and [true] are unique # nested [1] and [true] are unique
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
[ [
[ [
@ -396,7 +396,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_heterogeneous_types_are_valid_passes(self): def test_unique_heterogeneous_types_are_valid_passes(self):
# unique heterogeneous types are valid # unique heterogeneous types are valid
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
{ {
}, },
@ -414,7 +414,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_integers_is_invalid_fails(self): def test_non_unique_array_of_integers_is_invalid_fails(self):
# non-unique array of integers is invalid # non-unique array of integers is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data( UniqueitemsValidation.from_openapi_data_oapg(
[ [
1, 1,
1, 1,

View File

@ -22,7 +22,7 @@ class TestUriFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
UriFormat._from_openapi_data( UriFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestUriFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
UriFormat._from_openapi_data( UriFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
UriFormat._from_openapi_data( UriFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
UriFormat._from_openapi_data( UriFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
UriFormat._from_openapi_data( UriFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestUriFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
UriFormat._from_openapi_data( UriFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestUriReferenceFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
UriReferenceFormat._from_openapi_data( UriReferenceFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestUriReferenceFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
UriReferenceFormat._from_openapi_data( UriReferenceFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
UriReferenceFormat._from_openapi_data( UriReferenceFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
UriReferenceFormat._from_openapi_data( UriReferenceFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
UriReferenceFormat._from_openapi_data( UriReferenceFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestUriReferenceFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
UriReferenceFormat._from_openapi_data( UriReferenceFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -22,7 +22,7 @@ class TestUriTemplateFormat(unittest.TestCase):
def test_all_string_formats_ignore_objects_passes(self): def test_all_string_formats_ignore_objects_passes(self):
# all string formats ignore objects # all string formats ignore objects
UriTemplateFormat._from_openapi_data( UriTemplateFormat.from_openapi_data_oapg(
{ {
}, },
_configuration=self._configuration _configuration=self._configuration
@ -30,28 +30,28 @@ class TestUriTemplateFormat(unittest.TestCase):
def test_all_string_formats_ignore_booleans_passes(self): def test_all_string_formats_ignore_booleans_passes(self):
# all string formats ignore booleans # all string formats ignore booleans
UriTemplateFormat._from_openapi_data( UriTemplateFormat.from_openapi_data_oapg(
False, False,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_integers_passes(self): def test_all_string_formats_ignore_integers_passes(self):
# all string formats ignore integers # all string formats ignore integers
UriTemplateFormat._from_openapi_data( UriTemplateFormat.from_openapi_data_oapg(
12, 12,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_floats_passes(self): def test_all_string_formats_ignore_floats_passes(self):
# all string formats ignore floats # all string formats ignore floats
UriTemplateFormat._from_openapi_data( UriTemplateFormat.from_openapi_data_oapg(
13.7, 13.7,
_configuration=self._configuration _configuration=self._configuration
) )
def test_all_string_formats_ignore_arrays_passes(self): def test_all_string_formats_ignore_arrays_passes(self):
# all string formats ignore arrays # all string formats ignore arrays
UriTemplateFormat._from_openapi_data( UriTemplateFormat.from_openapi_data_oapg(
[ [
], ],
_configuration=self._configuration _configuration=self._configuration
@ -59,7 +59,7 @@ class TestUriTemplateFormat(unittest.TestCase):
def test_all_string_formats_ignore_nulls_passes(self): def test_all_string_formats_ignore_nulls_passes(self):
# all string formats ignore nulls # all string formats ignore nulls
UriTemplateFormat._from_openapi_data( UriTemplateFormat.from_openapi_data_oapg(
None, None,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -44,7 +44,7 @@ class TestRequestBodyPostAdditionalpropertiesAllowsASchemaWhichShouldValidateReq
1, 1,
} }
) )
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )
@ -82,7 +82,7 @@ class TestRequestBodyPostAdditionalpropertiesAllowsASchemaWhichShouldValidateReq
} }
) )
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )
@ -102,7 +102,7 @@ class TestRequestBodyPostAdditionalpropertiesAllowsASchemaWhichShouldValidateReq
True, True,
} }
) )
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -48,7 +48,7 @@ class TestRequestBodyPostAdditionalpropertiesAreAllowedByDefaultRequestBody(ApiT
True, True,
} }
) )
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -45,7 +45,7 @@ class TestRequestBodyPostAdditionalpropertiesCanExistByItselfRequestBody(ApiTest
} }
) )
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )
@ -61,7 +61,7 @@ class TestRequestBodyPostAdditionalpropertiesCanExistByItselfRequestBody(ApiTest
True, True,
} }
) )
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )

View File

@ -47,7 +47,7 @@ class TestRequestBodyPostAdditionalpropertiesShouldNotLookInApplicatorsRequestBo
} }
) )
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )
@ -65,7 +65,7 @@ class TestRequestBodyPostAdditionalpropertiesShouldNotLookInApplicatorsRequestBo
True, True,
} }
) )
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data( body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload, payload,
_configuration=self._configuration _configuration=self._configuration
) )

Some files were not shown because too many files have changed in this diff Show More