本文整理汇总了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
示例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{}'
示例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{}"
示例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() == '{}'
示例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() == "{}"
示例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'
示例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'
示例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"