# Path: src/japronto/router/route.py
# class RouteNotFoundException(Exception):
# class Route:
# class SegmentType(IntEnum):
#     def __init__(self, pattern, handler, methods):
#     def __repr__(self):
#     def describe(self):
#     def __eq__(self, other):
# def parse(pattern):
# def roundto8(v):
# def padto8(data):
# def compile(route):
# def compile_all(routes):
#     EXACT = 0
#     PLACEHOLDER = 1


import asyncio
import pytest
from collections import namedtuple
from .route import parse, MatcherEntry, Segment, SegmentType, Route, \
    compile, roundto8




@pytest.mark.parametrize('pattern,result', [
    ('/', [('exact', '/')]),
    ('/{{a}}', [('exact', '/{a}')]),
    ('{a}', [('placeholder', 'a')]),
    ('a/{a}', [('exact', 'a/'), ('placeholder', 'a')]),
    ('{a}/a', [('placeholder', 'a'), ('exact', '/a')]),
    ('{a}/{{a}}', [('placeholder', 'a'), ('exact', '/{a}')]),
    ('{a}/{b}', [('placeholder', 'a'), ('exact', '/'), ('placeholder', 'b')])
])
def test_parse(pattern, result):

# Path: src/japronto/router/route.py
# class RouteNotFoundException(Exception):
# class Route:
# class SegmentType(IntEnum):
#     def __init__(self, pattern, handler, methods):
#     def __repr__(self):
#     def describe(self):
#     def __eq__(self, other):
# def parse(pattern):
# def roundto8(v):
# def padto8(data):
# def compile(route):
# def compile_all(routes):
#     EXACT = 0
#     PLACEHOLDER = 1


# Path: src/japronto/router/test_route.py
import asyncio
import pytest
from collections import namedtuple
from .route import parse, MatcherEntry, Segment, SegmentType, Route, \
    compile, roundto8





@pytest.mark.parametrize('pattern,result', [
    ('/', [('exact', '/')]),
    ('/{{a}}', [('exact', '/{a}')]),
    ('{a}', [('placeholder', 'a')]),
    ('a/{a}', [('exact', 'a/'), ('placeholder', 'a')]),
    ('{a}/a', [('placeholder', 'a'), ('exact', '/a')]),
    ('{a}/{{a}}', [('placeholder', 'a'), ('exact', '/{a}')]),
    ('{a}/{b}', [('placeholder', 'a'), ('exact', '/'), ('placeholder', 'b')])
])
def test_parse(pattern, result):

    assert parse(pattern) == result