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


Python StepDict.step方法代码示例

本文整理汇总了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',), {}))
开发者ID:electroniceagle,项目名称:aloe,代码行数:34,代码来源:test_registry.py

示例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',), {})
开发者ID:kiawin,项目名称:aloe,代码行数:40,代码来源:test_registry.py


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