本文整理汇总了Python中aloe.registry.StepDict.step方法的典型用法代码示例。如果您正苦于以下问题:Python StepDict.step方法的具体用法?Python StepDict.step怎么用?Python StepDict.step使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aloe.registry.StepDict
的用法示例。
在下文中一共展示了StepDict.step方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_unload_reload
# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import step [as 别名]
def test_unload_reload():
"""
Test unloading and then reloading the step.
"""
def step(): # pylint:disable=missing-docstring
pass
steps = StepDict()
# Load
steps.step(r'My step (\d)')(step)
assert_matches(steps, "My step 1", (step, ('1',), {}))
# Members added to step by registering it
# pylint:disable=no-member
# Unload
step.unregister()
assert_no_match(steps, "My step 1")
# Should be a no-op
step.unregister()
assert_no_match(steps, "My step 1")
# Reload
steps.step(step.sentence)(step)
assert_matches(steps, "My step 1", (step, ('1',), {}))
示例2: test_unload_reload
# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import step [as 别名]
def test_unload_reload():
"""
Test unloading and then reloading the step.
"""
def step(): # pylint:disable=missing-docstring
pass
class StepDefinition(object):
"""A step definition object to match."""
sentence = 'My step 1'
steps = StepDict()
# Load
steps.step(r'My step (\d)')(step)
assert len(steps) == 1
assert steps.match_step(StepDefinition) == (step, ('1',), {})
# Members added to step by registering it
# pylint:disable=no-member
# Unload
step.unregister()
assert len(steps) == 0
# Should be a no-op
step.unregister()
assert len(steps) == 0
# Reload
steps.step(step.sentence)(step)
assert len(steps) == 1
assert steps.match_step(StepDefinition) == (step, ('1',), {})