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


Python Step.has_variables方法代码示例

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


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

示例1: test_mixed_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:31,代码来源:test_traject.py

示例2: test_multi_mixed_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:11,代码来源:test_traject.py

示例3: test_multi_mixed_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:11,代码来源:test_traject.py

示例4: test_variable_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:12,代码来源:test_traject.py

示例5: test_variable_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:12,代码来源:test_traject.py

示例6: test_name_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:13,代码来源:test_traject.py

示例7: test_mixed_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:16,代码来源:test_traject.py

示例8: test_mixed_step

# 需要导入模块: from morepath.traject import Step [as 别名]
# 或者: from morepath.traject.Step import has_variables [as 别名]
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,代码行数:16,代码来源:test_traject.py


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