# Path: lepo/apidef/doc.py
# class Swagger2APIDefinition(APIDefinition):
#     version = SWAGGER_2
#     operation_class = Swagger2Operation
# 
# Path: lepo/parameter_utils.py
# def cast_primitive_value(type, format, value):
#     if type == 'boolean':
#         return (force_str(value).lower() in ('1', 'yes', 'true'))
#     if type == 'integer' or format in ('integer', 'long'):
#         return int(value)
#     if type == 'number' or format in ('float', 'double'):
#         return float(value)
#     if format == 'byte':  # base64 encoded characters
#         return base64.b64decode(value)
#     if format == 'binary':  # any sequence of octets
#         return force_bytes(value)
#     if format == 'date':  # ISO8601 date
#         return iso8601.parse_date(value).date()
#     if format == 'dateTime':  # ISO8601 datetime
#         return iso8601.parse_date(value)
#     if type == 'string':
#         return force_str(value)
#     return value
# 
# Path: lepo_tests/tests/utils.py
# TESTS_DIR = os.path.dirname(__file__)
# DOC_VERSIONS = ['swagger2', 'openapi3']
# def get_router(fixture_name):
# def get_data_from_response(response, status=200):
# def cast_parameter_value(apidoc, parameter, value):
# def get_apidoc_from_version(version, content={}):
# def make_request_for_operation(operation, method='GET', query_string=''):


from collections import namedtuple
from datetime import date, datetime
from iso8601 import UTC
from lepo.apidef.doc import Swagger2APIDefinition
from lepo.parameter_utils import cast_primitive_value
from lepo_tests.tests.utils import (
    cast_parameter_value,
    doc_versions,
    get_apidoc_from_version,
)
import pytest



DATA_EXAMPLES = [
    {'spec': {'type': 'integer'}, 'input': '5041211', 'output': 5041211},
    {'spec': {'format': 'long'}, 'input': '88888888888888888888888', 'output': 88888888888888888888888},
    {'spec': {'format': 'float'}, 'input': '-6.3', 'output': -6.3},
    {'spec': {'format': 'double'}, 'input': '-6.7', 'output': -6.7},
    {'spec': {'type': 'string'}, 'input': '', 'output': ''},
    {'spec': {'type': 'string'}, 'input': 'hee', 'output': 'hee'},
    {'spec': {'format': 'byte'}, 'input': 'c3VyZS4=', 'output': b'sure.'},
    {'spec': {'format': 'binary'}, 'input': 'v', 'output': b'v'},
    {'spec': {'type': 'boolean'}, 'input': 'true', 'output': True},
    {'spec': {'type': 'boolean'}, 'input': 'false', 'output': False},
    {'spec': {'format': 'date'}, 'input': '2016-03-06 15:33:33', 'output': date(2016, 3, 6)},
    {'spec': {'format': 'date'}, 'input': '2016-03-06', 'output': date(2016, 3, 6)},
    {
        'spec': {'format': 'dateTime'}, 'input': '2016-03-06 15:33:33',
        'output': datetime(2016, 3, 6, 15, 33, 33, tzinfo=UTC)
    },
    {'spec': {'format': 'password'}, 'input': 'ffffffffffff', 'output': 'ffffffffffff'},
]


@pytest.mark.parametrize('case', DATA_EXAMPLES)
def test_data(case):

# Path: lepo/apidef/doc.py
# class Swagger2APIDefinition(APIDefinition):
#     version = SWAGGER_2
#     operation_class = Swagger2Operation
# 
# Path: lepo/parameter_utils.py
# def cast_primitive_value(type, format, value):
#     if type == 'boolean':
#         return (force_str(value).lower() in ('1', 'yes', 'true'))
#     if type == 'integer' or format in ('integer', 'long'):
#         return int(value)
#     if type == 'number' or format in ('float', 'double'):
#         return float(value)
#     if format == 'byte':  # base64 encoded characters
#         return base64.b64decode(value)
#     if format == 'binary':  # any sequence of octets
#         return force_bytes(value)
#     if format == 'date':  # ISO8601 date
#         return iso8601.parse_date(value).date()
#     if format == 'dateTime':  # ISO8601 datetime
#         return iso8601.parse_date(value)
#     if type == 'string':
#         return force_str(value)
#     return value
# 
# Path: lepo_tests/tests/utils.py
# TESTS_DIR = os.path.dirname(__file__)
# DOC_VERSIONS = ['swagger2', 'openapi3']
# def get_router(fixture_name):
# def get_data_from_response(response, status=200):
# def cast_parameter_value(apidoc, parameter, value):
# def get_apidoc_from_version(version, content={}):
# def make_request_for_operation(operation, method='GET', query_string=''):


# Path: lepo_tests/tests/test_datatypes.py
from collections import namedtuple
from datetime import date, datetime
from iso8601 import UTC
from lepo.apidef.doc import Swagger2APIDefinition
from lepo.parameter_utils import cast_primitive_value
from lepo_tests.tests.utils import (
    cast_parameter_value,
    doc_versions,
    get_apidoc_from_version,
)
import pytest




DATA_EXAMPLES = [
    {'spec': {'type': 'integer'}, 'input': '5041211', 'output': 5041211},
    {'spec': {'format': 'long'}, 'input': '88888888888888888888888', 'output': 88888888888888888888888},
    {'spec': {'format': 'float'}, 'input': '-6.3', 'output': -6.3},
    {'spec': {'format': 'double'}, 'input': '-6.7', 'output': -6.7},
    {'spec': {'type': 'string'}, 'input': '', 'output': ''},
    {'spec': {'type': 'string'}, 'input': 'hee', 'output': 'hee'},
    {'spec': {'format': 'byte'}, 'input': 'c3VyZS4=', 'output': b'sure.'},
    {'spec': {'format': 'binary'}, 'input': 'v', 'output': b'v'},
    {'spec': {'type': 'boolean'}, 'input': 'true', 'output': True},
    {'spec': {'type': 'boolean'}, 'input': 'false', 'output': False},
    {'spec': {'format': 'date'}, 'input': '2016-03-06 15:33:33', 'output': date(2016, 3, 6)},
    {'spec': {'format': 'date'}, 'input': '2016-03-06', 'output': date(2016, 3, 6)},
    {
        'spec': {'format': 'dateTime'}, 'input': '2016-03-06 15:33:33',
        'output': datetime(2016, 3, 6, 15, 33, 33, tzinfo=UTC)
    },
    {'spec': {'format': 'password'}, 'input': 'ffffffffffff', 'output': 'ffffffffffff'},
]


@pytest.mark.parametrize('case', DATA_EXAMPLES)
def test_data(case):

    spec = case['spec']