[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 True 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
- 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
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,
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 number + format: See .as_float, .as_int
- type string + format: See .as_date_oapg, .as_datetime_oapg, .as_decimal_oapg, .as_uuid_oapg
- 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
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 number format based type, use as_int/as_float
- 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_oapg/as_float_oapg
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,
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.
- 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
This was done because when payloads are ingested, they can be validated against N number of schemas.

View File

@ -112,7 +112,7 @@ class PrefixSeparatorIterator:
class ParameterSerializerBase:
@classmethod
def get_default_explode(cls, style: ParameterStyle) -> bool:
def _get_default_explode(cls, style: ParameterStyle) -> bool:
return False
@staticmethod
@ -142,7 +142,7 @@ class ParameterSerializerBase:
raise ApiValueError('Unable to generate a ref6570 item representation of {}'.format(in_data))
@staticmethod
def to_dict(name: str, value: str):
def _to_dict(name: str, value: str):
return {name: value}
@classmethod
@ -224,7 +224,7 @@ class ParameterSerializerBase:
)
@classmethod
def ref6570_expansion(
def _ref6570_expansion(
cls,
variable_name: str,
in_data: typing.Any,
@ -276,12 +276,12 @@ class ParameterSerializerBase:
class StyleFormSerializer(ParameterSerializerBase):
@classmethod
def get_default_explode(cls, style: ParameterStyle) -> bool:
def _get_default_explode(cls, style: ParameterStyle) -> bool:
if style is ParameterStyle.FORM:
return True
return super().get_default_explode(style)
return super()._get_default_explode(style)
def serialize_form(
def _serialize_form(
self,
in_data: typing.Union[None, int, float, str, bool, dict, list],
name: str,
@ -291,7 +291,7 @@ class StyleFormSerializer(ParameterSerializerBase):
) -> str:
if prefix_separator_iterator is None:
prefix_separator_iterator = PrefixSeparatorIterator('?', '&')
return self.ref6570_expansion(
return self._ref6570_expansion(
variable_name=name,
in_data=in_data,
explode=explode,
@ -302,7 +302,7 @@ class StyleFormSerializer(ParameterSerializerBase):
class StyleSimpleSerializer(ParameterSerializerBase):
def serialize_simple(
def _serialize_simple(
self,
in_data: typing.Union[None, int, float, str, bool, dict, list],
name: str,
@ -310,7 +310,7 @@ class StyleSimpleSerializer(ParameterSerializerBase):
percent_encode: bool
) -> str:
prefix_separator_iterator = PrefixSeparatorIterator('', ',')
return self.ref6570_expansion(
return self._ref6570_expansion(
variable_name=name,
in_data=in_data,
explode=explode,
@ -392,15 +392,6 @@ class ParameterBase:
self.schema = schema
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(
self,
in_data: typing.Union[None, int, float, str, bool, dict, list]
@ -431,45 +422,45 @@ class PathParameter(ParameterBase, StyleSimpleSerializer):
content=content
)
def _serialize_label(
def __serialize_label(
self,
in_data: typing.Union[None, int, float, str, bool, dict, list]
) -> typing.Dict[str, str]:
prefix_separator_iterator = PrefixSeparatorIterator('.', '.')
value = self.ref6570_expansion(
value = self._ref6570_expansion(
variable_name=self.name,
in_data=in_data,
explode=self.explode,
percent_encode=True,
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,
in_data: typing.Union[None, int, float, str, bool, dict, list]
) -> typing.Dict[str, str]:
prefix_separator_iterator = PrefixSeparatorIterator(';', ';')
value = self.ref6570_expansion(
value = self._ref6570_expansion(
variable_name=self.name,
in_data=in_data,
explode=self.explode,
percent_encode=True,
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,
in_data: typing.Union[None, int, float, str, bool, dict, list],
) -> typing.Dict[str, str]:
value = self.serialize_simple(
value = self._serialize_simple(
in_data=in_data,
name=self.name,
explode=self.explode,
percent_encode=True
)
return self.to_dict(self.name, value)
return self._to_dict(self.name, value)
def serialize(
self,
@ -490,18 +481,18 @@ class PathParameter(ParameterBase, StyleSimpleSerializer):
"""
if self.style:
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:
return self._serialize_label(cast_in_data)
return self.__serialize_label(cast_in_data)
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
for content_type, schema in self.content.items():
cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
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))
@ -518,7 +509,7 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
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_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__(
name,
@ -538,14 +529,14 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
) -> typing.Dict[str, str]:
if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator()
value = self.ref6570_expansion(
value = self._ref6570_expansion(
variable_name=self.name,
in_data=in_data,
explode=self.explode,
percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator
)
return self.to_dict(self.name, value)
return self._to_dict(self.name, value)
def __serialize_pipe_delimited(
self,
@ -554,14 +545,14 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
) -> typing.Dict[str, str]:
if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator()
value = self.ref6570_expansion(
value = self._ref6570_expansion(
variable_name=self.name,
in_data=in_data,
explode=self.explode,
percent_encode=True,
prefix_separator_iterator=prefix_separator_iterator
)
return self.to_dict(self.name, value)
return self._to_dict(self.name, value)
def __serialize_form(
self,
@ -570,14 +561,14 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
) -> typing.Dict[str, str]:
if prefix_separator_iterator is None:
prefix_separator_iterator = self.get_prefix_separator_iterator()
value = self.serialize_form(
value = self._serialize_form(
in_data,
name=self.name,
explode=self.explode,
percent_encode=True,
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]:
if not self.schema:
@ -625,7 +616,7 @@ class QueryParameter(ParameterBase, StyleFormSerializer):
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
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))
@ -642,7 +633,7 @@ class CookieParameter(ParameterBase, StyleFormSerializer):
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_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__(
name,
@ -672,21 +663,21 @@ class CookieParameter(ParameterBase, StyleFormSerializer):
TODO add escaping of comma, space, equals
or turn encoding on
"""
value = self.serialize_form(
value = self._serialize_form(
cast_in_data,
explode=self.explode,
name=self.name,
percent_encode=False,
prefix_separator_iterator=PrefixSeparatorIterator('', '&')
)
return self.to_dict(self.name, value)
return self._to_dict(self.name, value)
# self.content will be length one
for content_type, schema in self.content.items():
cast_in_data = schema(in_data)
cast_in_data = self._json_encoder.default(cast_in_data)
if content_type == self._json_content_type:
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))
@ -721,12 +712,6 @@ class HeaderParameter(ParameterBase, StyleSimpleSerializer):
headers.extend(data)
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(
self,
in_data: typing.Union[
@ -741,7 +726,7 @@ class HeaderParameter(ParameterBase, StyleSimpleSerializer):
returns headers: dict
"""
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),))
# self.content will be length one
for content_type, schema in self.content.items():
@ -929,7 +914,7 @@ class OpenApiResponse(JSONDetector):
content_type = 'multipart/form-data'
else:
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)
elif streamed:
response.release_conn()
@ -1263,7 +1248,7 @@ class Api:
self.api_client = api_client
@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:
- required keys are present
@ -1305,7 +1290,7 @@ class Api:
)
)
def get_host(
def _get_host_oapg(
self,
operation_id: str,
servers: typing.Tuple[typing.Dict[str, str], ...] = tuple(),
@ -1454,7 +1439,7 @@ class RequestBody(StyleFormSerializer, JSONDetector):
raise ValueError(
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)
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)
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.body, {{httpMethod}}.{{schema.baseName}})
deserialized_response_body = {{httpMethod}}.{{schema.baseName}}._from_openapi_data(
deserialized_response_body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)
@ -106,7 +106,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase):
{{/with}}
)
{{#if valid}}
body = {{httpMethod}}.{{schema.baseName}}._from_openapi_data(
body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)
@ -120,7 +120,7 @@ class Test{{operationIdSnakeCase}}(ApiTestMixin, unittest.TestCase):
assert isinstance(api_response.body, schemas.Unset)
{{else}}
with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)):
body = {{httpMethod}}.{{schema.baseName}}._from_openapi_data(
body = {{httpMethod}}.{{schema.baseName}}.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)

View File

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

View File

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

View File

@ -1,5 +1,9 @@
import decimal # 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 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):
# {{description}}
{{#if valid}}
{{classname}}._from_openapi_data(
{{classname}}.from_openapi_data_oapg(
{{#with data}}
{{> model_templates/payload_renderer endChar=',' }}
{{/with}}
@ -28,7 +28,7 @@ class Test{{classname}}(unittest.TestCase):
)
{{else}}
with self.assertRaises(({{packageName}}.ApiValueError, {{packageName}}.ApiTypeError)):
{{classname}}._from_openapi_data(
{{classname}}.from_openapi_data_oapg(
{{#with data}}
{{> model_templates/payload_renderer endChar=','}}
{{/with}}

View File

@ -29,19 +29,19 @@ object schema properties as classes
- ingested None will subclass NoneClass
- ingested True 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
- 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
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,
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 number + format: See .as_float, .as_int
- type string + format: See .as_date_oapg, .as_datetime_oapg, .as_decimal_oapg, .as_uuid_oapg
- 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
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 number format based type, use as_int/as_float
- 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_oapg/as_float_oapg
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,
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.
- 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
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):
# no additional properties is valid
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
AdditionalpropertiesAllowsASchemaWhichShouldValidate.from_openapi_data_oapg(
{
"foo":
1,
@ -33,7 +33,7 @@ class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase
def test_an_additional_invalid_property_is_invalid_fails(self):
# an additional invalid property is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
AdditionalpropertiesAllowsASchemaWhichShouldValidate.from_openapi_data_oapg(
{
"foo":
1,
@ -47,7 +47,7 @@ class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase
def test_an_additional_valid_property_is_valid_passes(self):
# an additional valid property is valid
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
AdditionalpropertiesAllowsASchemaWhichShouldValidate.from_openapi_data_oapg(
{
"foo":
1,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_an_object_is_not_an_integer_fails(self):
# an object is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
{
},
_configuration=self._configuration
@ -32,7 +32,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_string_is_not_an_integer_fails(self):
# a string is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
"foo",
_configuration=self._configuration
)
@ -40,14 +40,14 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_null_is_not_an_integer_fails(self):
# null is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
None,
_configuration=self._configuration
)
def test_a_float_with_zero_fractional_part_is_an_integer_passes(self):
# a float with zero fractional part is an integer
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
1.0,
_configuration=self._configuration
)
@ -55,7 +55,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_float_is_not_an_integer_fails(self):
# a float is not an integer
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
)
@ -63,14 +63,14 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_a_boolean_is_not_an_integer_fails(self):
# a boolean is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
True,
_configuration=self._configuration
)
def test_an_integer_is_an_integer_passes(self):
# an integer is an integer
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
1,
_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):
# a string is still not an integer, even if it looks like one
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
"1",
_configuration=self._configuration
)
@ -86,7 +86,7 @@ class TestIntegerTypeMatchesIntegers(unittest.TestCase):
def test_an_array_is_not_an_integer_fails(self):
# an array is not an integer
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
IntegerTypeMatchesIntegers._from_openapi_data(
IntegerTypeMatchesIntegers.from_openapi_data_oapg(
[
],
_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):
# always invalid, but naive implementations may raise an overflow error
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data(
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.from_openapi_data_oapg(
1.0E308,
_configuration=self._configuration
)
def test_valid_integer_with_multipleof_float_passes(self):
# valid integer with multipleOf float
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data(
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.from_openapi_data_oapg(
123456789,
_configuration=self._configuration
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ class TestNestedItems(unittest.TestCase):
def test_valid_nested_array_passes(self):
# 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):
# nested array with invalid type
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):
# not deep enough
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):
# anything non-null is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
NestedOneofToCheckValidationSemantics._from_openapi_data(
NestedOneofToCheckValidationSemantics.from_openapi_data_oapg(
123,
_configuration=self._configuration
)
def test_null_is_valid_passes(self):
# null is valid
NestedOneofToCheckValidationSemantics._from_openapi_data(
NestedOneofToCheckValidationSemantics.from_openapi_data_oapg(
None,
_configuration=self._configuration
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,21 +23,21 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_1_is_not_a_string_fails(self):
# 1 is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
1,
_configuration=self._configuration
)
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
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
"1",
_configuration=self._configuration
)
def test_an_empty_string_is_still_a_string_passes(self):
# an empty string is still a string
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
"",
_configuration=self._configuration
)
@ -45,7 +45,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_a_float_is_not_a_string_fails(self):
# a float is not a string
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
)
@ -53,7 +53,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_an_object_is_not_a_string_fails(self):
# an object is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
{
},
_configuration=self._configuration
@ -62,7 +62,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_an_array_is_not_a_string_fails(self):
# an array is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
[
],
_configuration=self._configuration
@ -71,7 +71,7 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_a_boolean_is_not_a_string_fails(self):
# a boolean is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
True,
_configuration=self._configuration
)
@ -79,14 +79,14 @@ class TestStringTypeMatchesStrings(unittest.TestCase):
def test_null_is_not_a_string_fails(self):
# null is not a string
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
None,
_configuration=self._configuration
)
def test_a_string_is_a_string_passes(self):
# a string is a string
StringTypeMatchesStrings._from_openapi_data(
StringTypeMatchesStrings.from_openapi_data_oapg(
"foo",
_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):
# missing properties are not filled in with the default
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data(
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.from_openapi_data_oapg(
{
},
_configuration=self._configuration
@ -30,7 +30,7 @@ class TestTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing(unittest.Test
def test_an_explicit_property_value_is_checked_against_maximum_passing_passes(self):
# an explicit property value is checked against maximum (passing)
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data(
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.from_openapi_data_oapg(
{
"alpha":
1,
@ -41,7 +41,7 @@ class TestTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing(unittest.Test
def test_an_explicit_property_value_is_checked_against_maximum_failing_fails(self):
# an explicit property value is checked against maximum (failing)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data(
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.from_openapi_data_oapg(
{
"alpha":
5,

View File

@ -22,7 +22,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_integers_is_valid_passes(self):
# non-unique array of integers is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
1,
1,
@ -32,7 +32,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_objects_is_valid_passes(self):
# unique array of objects is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
{
"foo":
@ -48,7 +48,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_nested_objects_is_valid_passes(self):
# non-unique array of nested objects is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
{
"foo":
@ -76,7 +76,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_objects_is_valid_passes(self):
# non-unique array of objects is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
{
"foo":
@ -92,7 +92,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_1_and_true_are_unique_passes(self):
# 1 and true are unique
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
1,
True,
@ -102,7 +102,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_integers_is_valid_passes(self):
# unique array of integers is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
1,
2,
@ -112,7 +112,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_array_of_arrays_is_valid_passes(self):
# non-unique array of arrays is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
[
"foo",
@ -126,7 +126,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_numbers_are_unique_if_mathematically_unequal_passes(self):
# numbers are unique if mathematically unequal
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
1.0,
1.0,
@ -137,7 +137,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_false_is_not_equal_to_zero_passes(self):
# false is not equal to zero
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
0,
False,
@ -147,7 +147,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_nested_objects_is_valid_passes(self):
# unique array of nested objects is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
{
"foo":
@ -175,7 +175,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_0_and_false_are_unique_passes(self):
# 0 and false are unique
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
0,
False,
@ -185,7 +185,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_unique_array_of_arrays_is_valid_passes(self):
# unique array of arrays is valid
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
[
"foo",
@ -199,7 +199,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_true_is_not_equal_to_one_passes(self):
# true is not equal to one
UniqueitemsFalseValidation._from_openapi_data(
UniqueitemsFalseValidation.from_openapi_data_oapg(
[
1,
True,
@ -209,7 +209,7 @@ class TestUniqueitemsFalseValidation(unittest.TestCase):
def test_non_unique_heterogeneous_types_are_valid_passes(self):
# 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):
# 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):
# unique array of objects is valid
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"foo":
@ -38,7 +38,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_a_true_and_a1_are_unique_passes(self):
# {"a": true} and {"a": 1} are unique
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"a":
@ -55,7 +55,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_heterogeneous_types_are_invalid_fails(self):
# non-unique heterogeneous types are invalid
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):
# 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):
# {"a": false} and {"a": 0} are unique
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"a":
@ -110,7 +110,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_numbers_are_unique_if_mathematically_unequal_fails(self):
# numbers are unique if mathematically unequal
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
1.0,
1.0,
@ -121,7 +121,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_false_is_not_equal_to_zero_passes(self):
# false is not equal to zero
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
0,
False,
@ -131,7 +131,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_0_and_false_are_unique_passes(self):
# [0] and [false] are unique
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
[
0,
@ -145,7 +145,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_arrays_is_valid_passes(self):
# unique array of arrays is valid
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
[
"foo",
@ -160,7 +160,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_nested_objects_is_invalid_fails(self):
# non-unique array of nested objects is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"foo":
@ -189,7 +189,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_more_than_two_integers_is_invalid_fails(self):
# non-unique array of more than two integers is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
1,
2,
@ -200,7 +200,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_true_is_not_equal_to_one_passes(self):
# true is not equal to one
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
1,
True,
@ -211,7 +211,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_objects_are_non_unique_despite_key_order_fails(self):
# objects are non-unique despite key order
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"a":
@ -231,7 +231,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_strings_is_valid_passes(self):
# unique array of strings is valid
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
"foo",
"bar",
@ -242,7 +242,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_1_and_true_are_unique_passes(self):
# [1] and [true] are unique
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
[
1,
@ -256,7 +256,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_different_objects_are_unique_passes(self):
# different objects are unique
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"a":
@ -276,7 +276,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_integers_is_valid_passes(self):
# unique array of integers is valid
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
1,
2,
@ -287,7 +287,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_more_than_two_arrays_is_invalid_fails(self):
# non-unique array of more than two arrays is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
[
"foo",
@ -305,7 +305,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_objects_is_invalid_fails(self):
# non-unique array of objects is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"foo":
@ -321,7 +321,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_unique_array_of_nested_objects_is_valid_passes(self):
# unique array of nested objects is valid
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
{
"foo":
@ -350,7 +350,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_arrays_is_invalid_fails(self):
# non-unique array of arrays is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
[
"foo",
@ -365,7 +365,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_non_unique_array_of_strings_is_invalid_fails(self):
# non-unique array of strings is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
"foo",
"bar",
@ -376,7 +376,7 @@ class TestUniqueitemsValidation(unittest.TestCase):
def test_nested1_and_true_are_unique_passes(self):
# 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):
# 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):
# non-unique array of integers is invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
UniqueitemsValidation._from_openapi_data(
UniqueitemsValidation.from_openapi_data_oapg(
[
1,
1,

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class TestRequestBodyPostAdditionalpropertiesAllowsASchemaWhichShouldValidateReq
1,
}
)
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)
@ -82,7 +82,7 @@ class TestRequestBodyPostAdditionalpropertiesAllowsASchemaWhichShouldValidateReq
}
)
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,
_configuration=self._configuration
)
@ -102,7 +102,7 @@ class TestRequestBodyPostAdditionalpropertiesAllowsASchemaWhichShouldValidateReq
True,
}
)
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)

View File

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

View File

@ -45,7 +45,7 @@ class TestRequestBodyPostAdditionalpropertiesCanExistByItselfRequestBody(ApiTest
}
)
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,
_configuration=self._configuration
)
@ -61,7 +61,7 @@ class TestRequestBodyPostAdditionalpropertiesCanExistByItselfRequestBody(ApiTest
True,
}
)
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)

View File

@ -47,7 +47,7 @@ class TestRequestBodyPostAdditionalpropertiesShouldNotLookInApplicatorsRequestBo
}
)
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,
_configuration=self._configuration
)
@ -65,7 +65,7 @@ class TestRequestBodyPostAdditionalpropertiesShouldNotLookInApplicatorsRequestBo
True,
}
)
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
body = post.SchemaForRequestBodyApplicationJson.from_openapi_data_oapg(
payload,
_configuration=self._configuration
)

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