当前位置: 首页>>代码示例>>Python>>正文


Python traject.Step类代码示例

本文整理汇总了Python中morepath.traject.Step的典型用法代码示例。如果您正苦于以下问题:Python Step类的具体用法?Python Step怎么用?Python Step使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Step类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_multi_mixed_step

def test_multi_mixed_step():
    step = Step('{foo}a{bar}')
    assert step.s == '{foo}a{bar}'
    assert step.generalized == '{}a{}'
    assert step.parts == ('', 'a', '')
    assert step.names == ['foo', 'bar']
    assert step.converters == {}
    assert step.has_variables()
    assert step.discriminator_info() == '{}a{}'
开发者ID:blaflamme,项目名称:morepath,代码行数:9,代码来源:test_traject.py

示例2: test_multi_mixed_step

def test_multi_mixed_step():
    step = Step("{foo}a{bar}")
    assert step.s == "{foo}a{bar}"
    assert step.generalized == "{}a{}"
    assert step.parts == ("", "a", "")
    assert step.names == ["foo", "bar"]
    assert step.converters == {}
    assert step.has_variables()
    assert step.discriminator_info() == "{}a{}"
开发者ID:reinout,项目名称:morepath,代码行数:9,代码来源:test_traject.py

示例3: test_variable_step

def test_variable_step():
    step = Step('{foo}')
    assert step.s == '{foo}'
    assert step.generalized == '{}'
    assert step.parts == ('', '')
    assert step.names == ['foo']
    assert step.converters == {}
    assert step.has_variables()
    assert step.match('bar') == (True, {'foo': 'bar'})
    assert step.discriminator_info() == '{}'
开发者ID:blaflamme,项目名称:morepath,代码行数:10,代码来源:test_traject.py

示例4: test_variable_step

def test_variable_step():
    step = Step("{foo}")
    assert step.s == "{foo}"
    assert step.generalized == "{}"
    assert step.parts == ("", "")
    assert step.names == ["foo"]
    assert step.converters == {}
    assert step.has_variables()
    assert step.match("bar") == (True, {"foo": "bar"})
    assert step.discriminator_info() == "{}"
开发者ID:reinout,项目名称:morepath,代码行数:10,代码来源:test_traject.py

示例5: test_name_step

def test_name_step():
    step = Step('foo')
    assert step.s == 'foo'
    assert step.generalized == 'foo'
    assert step.parts == ('foo',)
    assert step.names == []
    assert step.converters == {}
    assert not step.has_variables()
    assert step.match('foo') == (True, {})
    assert step.match('bar') == (False, {})
    assert step.discriminator_info() == 'foo'
开发者ID:blaflamme,项目名称:morepath,代码行数:11,代码来源:test_traject.py

示例6: test_converter

def test_converter():
    step = Step('{foo}', converters=dict(foo=Converter(int)))
    assert step.discriminator_info() == '{}'

    variables = {}
    assert step.match('1', variables)
    assert variables == {'foo': 1}

    variables = {}
    assert not step.match('x', variables)
    assert not variables
开发者ID:morepath,项目名称:morepath,代码行数:11,代码来源:test_traject.py

示例7: test_mixed_step

def test_mixed_step():
    step = Step('a{foo}b')
    assert step.s == 'a{foo}b'
    assert step.generalized == 'a{}b'
    assert step.parts == ('a', 'b')
    assert step.names == ['foo']
    assert step.converters == {}
    assert step.has_variables()
    assert step.discriminator_info() == 'a{}b'

    variables = {}
    assert step.match('abarb', variables)
    assert variables == {'foo': 'bar'}

    variables = {}
    assert not step.match('ab', variables)
    assert not variables

    variables = {}
    assert not step.match('xbary', variables)
    assert not variables

    variables = {}
    assert not step.match('yabarbx', variables)
    assert not variables

    variables = {}
    assert not step.match('afoo', variables)
    assert not variables
开发者ID:morepath,项目名称:morepath,代码行数:29,代码来源:test_traject.py

示例8: test_mixed_step

def test_mixed_step():
    step = Step('a{foo}b')
    assert step.s == 'a{foo}b'
    assert step.generalized == 'a{}b'
    assert step.parts == ('a', 'b')
    assert step.names == ['foo']
    assert step.converters == [str]
    assert step.has_variables()
    assert step.match('abarb') == (True, {'foo': 'bar'})
    assert step.match('ab') == (False, {})
    assert step.match('xbary') == (False, {})
    assert step.match('yabarbx') == (False, {})
    assert step.match('afoo') == (False, {})
    assert step.discriminator_info() == 'a{str}b'
开发者ID:kod3r,项目名称:morepath,代码行数:14,代码来源:test_traject.py

示例9: test_mixed_step

def test_mixed_step():
    step = Step("a{foo}b")
    assert step.s == "a{foo}b"
    assert step.generalized == "a{}b"
    assert step.parts == ("a", "b")
    assert step.names == ["foo"]
    assert step.converters == {}
    assert step.has_variables()
    assert step.match("abarb") == (True, {"foo": "bar"})
    assert step.match("ab") == (False, {})
    assert step.match("xbary") == (False, {})
    assert step.match("yabarbx") == (False, {})
    assert step.match("afoo") == (False, {})
    assert step.discriminator_info() == "a{}b"
开发者ID:reinout,项目名称:morepath,代码行数:14,代码来源:test_traject.py

示例10: test_converter

def test_converter():
    step = Step('{foo}', converters=dict(foo=Converter(int)))
    assert step.match('1') == (True, {'foo': 1})
    assert step.match('x') == (False, {})
    assert step.discriminator_info() == '{}'
开发者ID:blaflamme,项目名称:morepath,代码行数:5,代码来源:test_traject.py

示例11: test_converter

def test_converter():
    step = Step('{foo:int}')
    assert step.match('1') == (True, {'foo': 1})
    assert step.match('x') == (False, {})
    assert step.discriminator_info() == '{int}'
开发者ID:kod3r,项目名称:morepath,代码行数:5,代码来源:test_traject.py


注:本文中的morepath.traject.Step类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。