# Path: crosscompute/scripts/serve.py
# def do(arguments=None):
# def configure_argument_parser_for_serving(a):
# def serve_with(automation, args):
# def serve(
#         automation, host=HOST, port=PORT, with_browser=True,
#         is_static=False, is_production=False,
#         base_uri='', allowed_origins=None,
#         disk_poll_in_milliseconds=DISK_POLL_IN_MILLISECONDS,
#         disk_debounce_in_milliseconds=DISK_DEBOUNCE_IN_MILLISECONDS):
# L = getLogger(__name__)


from crosscompute.scripts.serve import parse_template_parts
from crosscompute.types import DataItem
    template = '{x}'
    x, y = DataItem('x', 1), DataItem('y', 2)
    parts = parse_template_parts(template, [x, y])
    assert parts == [x, y]


def test_missing_variable_with_text():
    template = 'abc {x} xyz'
    x, y = DataItem('x', 1), DataItem('y', 2)
    parts = parse_template_parts(template, [x, y])
    assert parts == ['abc', x, 'xyz', y]


def test_extra_variable():
    template = '{x} {z}'
    x, y = DataItem('x', 1), DataItem('y', 2)
    parts = parse_template_parts(template, [x, y])
    assert parts == [x, '{ z }', y]


def test_variable_with_name():
    template = '{x : xyz}'
    x = DataItem('x', 1)
    parts = parse_template_parts(template, [x])
    assert parts[0].name == 'xyz'


def test_variable_with_name_and_help():
    template = '{x : xyz ? what is x?}'
    x = DataItem('x', 1)

# Path: crosscompute/scripts/serve.py
# def do(arguments=None):
# def configure_argument_parser_for_serving(a):
# def serve_with(automation, args):
# def serve(
#         automation, host=HOST, port=PORT, with_browser=True,
#         is_static=False, is_production=False,
#         base_uri='', allowed_origins=None,
#         disk_poll_in_milliseconds=DISK_POLL_IN_MILLISECONDS,
#         disk_debounce_in_milliseconds=DISK_DEBOUNCE_IN_MILLISECONDS):
# L = getLogger(__name__)


# Path: experiments/0.7/tests/x_template.py
from crosscompute.scripts.serve import parse_template_parts
from crosscompute.types import DataItem

    template = '{x}'
    x, y = DataItem('x', 1), DataItem('y', 2)
    parts = parse_template_parts(template, [x, y])
    assert parts == [x, y]


def test_missing_variable_with_text():
    template = 'abc {x} xyz'
    x, y = DataItem('x', 1), DataItem('y', 2)
    parts = parse_template_parts(template, [x, y])
    assert parts == ['abc', x, 'xyz', y]


def test_extra_variable():
    template = '{x} {z}'
    x, y = DataItem('x', 1), DataItem('y', 2)
    parts = parse_template_parts(template, [x, y])
    assert parts == [x, '{ z }', y]


def test_variable_with_name():
    template = '{x : xyz}'
    x = DataItem('x', 1)
    parts = parse_template_parts(template, [x])
    assert parts[0].name == 'xyz'


def test_variable_with_name_and_help():
    template = '{x : xyz ? what is x?}'
    x = DataItem('x', 1)

    parts = parse_template_parts(template, [x])