コード例 #1
0
def test_basics():
    rt = RouteTree()
    rt.set(['a', 'b'], 100, True)
    assert rt.get(['a', 'b'], True) == (100, {})
コード例 #2
0
def test_non_strict():
    rt = RouteTree()
    rt.set(['a', 'b'], 100, True)
    assert rt.get(['a', 'b', 'c'], False) == (100, {})
コード例 #3
0
def test_non_existance():
    rt = RouteTree()
    rt.set(['a'], 200, True)
    assert rt.get(['b'], True) == (None, {})
コード例 #4
0
def test_wildcard():
    rt = RouteTree()
    rt.set(['c', ':d'], 200, True)
    assert rt.get(['c', 'x'], True) == (200, {'d': 'x'})