# Path: lepo/codegen.py
# HANDLER_TEMPLATE = '''
# def {func_name}(request, {parameters}):
#     raise NotImplementedError('Handler {operation_id} not implemented')
# '''.strip()
# def generate_handler_stub(router, handler_template=HANDLER_TEMPLATE):
# def cmdline(args=None):  # pragma: no cover
# 
# 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=''):


import os
from lepo import codegen
from lepo_tests.tests.utils import doc_versions



@doc_versions
def test_codegen(doc_version, capsys):
    path = os.path.realpath(os.path.join(os.path.dirname(__file__), doc_version, 'petstore-expanded.yaml'))
    codegen.cmdline([path])
    out, err = capsys.readouterr()
    # Compile to test for syntax errors

# Path: lepo/codegen.py
# HANDLER_TEMPLATE = '''
# def {func_name}(request, {parameters}):
#     raise NotImplementedError('Handler {operation_id} not implemented')
# '''.strip()
# def generate_handler_stub(router, handler_template=HANDLER_TEMPLATE):
# def cmdline(args=None):  # pragma: no cover
# 
# 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_codegen.py
import os
from lepo import codegen
from lepo_tests.tests.utils import doc_versions




@doc_versions
def test_codegen(doc_version, capsys):
    path = os.path.realpath(os.path.join(os.path.dirname(__file__), doc_version, 'petstore-expanded.yaml'))
    codegen.cmdline([path])
    out, err = capsys.readouterr()
    # Compile to test for syntax errors

    compile(out, f'{doc_version}-generated.py', 'exec')