<commit_before>import datetime
import uuid

import mock
import pytest

from openapi_core.extensions.models.models import Model
from openapi_core.schema.schemas.enums import SchemaFormat, SchemaType
from openapi_core.schema.schemas.exceptions import (
    InvalidSchemaValue, MultipleOneOfSchema, NoOneOfSchema, OpenAPISchemaError,
    UndefinedSchemaProperty
)
from openapi_core.schema.schemas.models import Schema

from six import b, u


class TestSchemaIteritems(object):

    @pytest.fixture
    def schema(self):
        properties = {
            'application/json': mock.sentinel.application_json,
            'text/csv': mock.sentinel.text_csv,
        }
        return Schema('object', properties=properties)

    @property
    def test_valid(self, schema):
        for name in schema.properties.keys():
            assert schema[name] == schema.properties[name]


class TestSchemaUnmarshal(object):

    def test_deprecated(self):
        schema = Schema('string', deprecated=True)
        value = 'test'

        with pytest.warns(DeprecationWarning):
            result = schema.unmarshal(value)

        assert result == value

    def test_string_valid(self):
        schema = Schema('string')
        value = 'test'

        result = schema.unmarshal(value)

        assert result == value

    def test_string_format_uuid_valid(self):
        schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.UUID)
        value = str(uuid.uuid4())

        result = schema.unmarshal(value)

        assert result == uuid.UUID(value)

    def test_string_format_uuid_valid(self):
        schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.UUID)
        value = uuid.uuid4()

        result = schema.unmarshal(value, strict=False)

        assert result == value

    def test_string_float_invalid(self):
        schema = Schema('string')
        value = 1.23

        with pytest.raises(InvalidSchemaValue):
            schema.unmarshal(value)
<commit_msg>Test string format quirks rename fix<commit_after>import datetime
import uuid

import mock
import pytest

from openapi_core.extensions.models.models import Model
from openapi_core.schema.schemas.enums import SchemaFormat, SchemaType
from openapi_core.schema.schemas.exceptions import (
    InvalidSchemaValue, MultipleOneOfSchema, NoOneOfSchema, OpenAPISchemaError,
    UndefinedSchemaProperty
)
from openapi_core.schema.schemas.models import Schema

from six import b, u


class TestSchemaIteritems(object):

    @pytest.fixture
    def schema(self):
        properties = {
            'application/json': mock.sentinel.application_json,
            'text/csv': mock.sentinel.text_csv,
        }
        return Schema('object', properties=properties)

    @property
    def test_valid(self, schema):
        for name in schema.properties.keys():
            assert schema[name] == schema.properties[name]


class TestSchemaUnmarshal(object):

    def test_deprecated(self):
        schema = Schema('string', deprecated=True)
        value = 'test'

        with pytest.warns(DeprecationWarning):
            result = schema.unmarshal(value)

        assert result == value

    def test_string_valid(self):
        schema = Schema('string')
        value = 'test'

        result = schema.unmarshal(value)

        assert result == value

    def test_string_format_uuid_valid(self):
        schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.UUID)
        value = str(uuid.uuid4())

        result = schema.unmarshal(value)

        assert result == uuid.UUID(value)

    def test_string_format_uuid_uuid_quirks_valid(self):
        schema = Schema(SchemaType.STRING, schema_format=SchemaFormat.UUID)
        value = uuid.uuid4()

        result = schema.unmarshal(value, strict=False)

        assert result == value

    def test_string_float_invalid(self):
        schema = Schema('string')
        value = 1.23

        with pytest.raises(InvalidSchemaValue):
            schema.unmarshal(value)

{'fraction_non_alphanumeric': 0.08920070157855174, 'fraction_numerical': 0.0025056376847907794, 'mean_word_length': 3.0404858299595143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7466655', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1102, 'n_words': 243}