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


Python StepDict.load_steps方法代码示例

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


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

示例1: test_StepDict_can_exclude_methods_when_load_steps

# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import load_steps [as 别名]
def test_StepDict_can_exclude_methods_when_load_steps():
    """
    aloe.STEP_REGISTRY.load_steps(obj) don't load exluded attr in
    STEP_REGISTRY
    """
    steps = StepDict()

    class LotsOfSteps(object):
        """A class defining some steps."""
        exclude = ["step_1"]

        def step_1(self):  # pylint:disable=missing-docstring
            pass

        def step_2(self):
            """Doing something"""
            pass

    step_list = LotsOfSteps()
    steps.load_steps(step_list)

    expected_sentence1 = re.compile("Step 1", re.I | re.U)
    expected_sentence2 = re.compile("Doing something", re.I | re.U)
    assert_not_in(expected_sentence1, steps)
    assert_in(expected_sentence2, steps)
开发者ID:kiawin,项目名称:aloe,代码行数:27,代码来源:test_registry.py

示例2: test_StepDict_can_load_steps_from_an_object

# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import load_steps [as 别名]
def test_StepDict_can_load_steps_from_an_object():
    """
    aloe.STEP_REGISTRY.load_steps(obj) append all obj methods to
    STEP_REGISTRY
    """
    steps = StepDict()

    class LotsOfSteps(object):
        """A class defining some steps."""

        def step_1(self):  # pylint:disable=missing-docstring
            pass

        def step_2(self):
            """Doing something"""
            pass

    step_list = LotsOfSteps()
    steps.load_steps(step_list)

    expected_sentence1 = re.compile("Step 1", re.I | re.U)
    expected_sentence2 = re.compile("Doing something", re.I | re.U)
    assert_in(expected_sentence1, steps)
    assert_in(expected_sentence2, steps)
    assert_equal(steps[expected_sentence1], step_list.step_1)
    assert_equal(steps[expected_sentence2], step_list.step_2)
开发者ID:kiawin,项目名称:aloe,代码行数:28,代码来源:test_registry.py

示例3: test_StepDict_can_exclude_callable_object_when_load_steps

# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import load_steps [as 别名]
def test_StepDict_can_exclude_callable_object_when_load_steps():
    """
    aloe.STEP_REGISTRY.load_steps(obj) don't load callable objets in
    STEP_REGISTRY
    """
    steps = StepDict()

    class NoStep(object):
        """A class defining something that's not a step."""
        class NotAStep(object):
            """A callable which isn't a step."""
            def __call__(self):
                pass

    no_step = NoStep()
    steps.load_steps(no_step)

    assert len(steps) == 0
开发者ID:electroniceagle,项目名称:aloe,代码行数:20,代码来源:test_registry.py

示例4: test_StepDict_can_load_steps_from_an_object

# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import load_steps [as 别名]
def test_StepDict_can_load_steps_from_an_object():
    """
    aloe.STEP_REGISTRY.load_steps(obj) append all obj methods to
    STEP_REGISTRY
    """
    steps = StepDict()

    class LotsOfSteps(object):
        """A class defining some steps."""

        def step_1(self):  # pylint:disable=missing-docstring
            pass

        def step_2(self):
            """Doing something"""
            pass

    step_list = LotsOfSteps()
    steps.load_steps(step_list)

    assert_matches(steps, "Step 1", (step_list.step_1, (), {}))
    assert_matches(steps, "Doing something", (step_list.step_2, (), {}))
开发者ID:electroniceagle,项目名称:aloe,代码行数:24,代码来源:test_registry.py

示例5: test_StepDict_can_exclude_methods_when_load_steps

# 需要导入模块: from aloe.registry import StepDict [as 别名]
# 或者: from aloe.registry.StepDict import load_steps [as 别名]
def test_StepDict_can_exclude_methods_when_load_steps():
    """
    aloe.STEP_REGISTRY.load_steps(obj) don't load exluded attr in
    STEP_REGISTRY
    """
    steps = StepDict()

    class LotsOfSteps(object):
        """A class defining some steps."""
        exclude = ["step_1"]

        def step_1(self):  # pylint:disable=missing-docstring
            pass

        def step_2(self):
            """Doing something"""
            pass

    step_list = LotsOfSteps()
    steps.load_steps(step_list)

    assert_no_match(steps, "Step 1")
    assert_matches(steps, "Doing something", (step_list.step_2, (), {}))
开发者ID:electroniceagle,项目名称:aloe,代码行数:25,代码来源:test_registry.py


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