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


Python behave.then方法代码示例

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


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

示例1: map_assertion

# 需要导入模块: import behave [as 别名]
# 或者: from behave import then [as 别名]
def map_assertion(step_text: str, existing_step_or_steps: Union[str, List[str]]) -> None:
    """
    Map a new "then" step to one or many existing one(s).
    Parameters are propagated to the original step(s) as well, as expected.

    map_assertion('door is open', 'state door open is active')
    map_assertion('{x} seconds elapsed', 'I wait for {x} seconds')
    map_assertion('assert two things', ['first thing to assert', 'second thing to assert'])

    :param step_text: Text of the new step, without the "then" keyword.
    :param existing_step_or_steps: existing step, without "then" keyword. Could be a list of steps.
    """
    if not isinstance(existing_step_or_steps, str):
        existing_step_or_steps = '\nand '.join(existing_step_or_steps)

    @then(step_text)
    def _(context, **kwargs):
        context.execute_steps('Then ' + existing_step_or_steps.format(**kwargs)) 
开发者ID:AlexandreDecan,项目名称:sismic,代码行数:20,代码来源:wrappers.py

示例2: step_impl6

# 需要导入模块: import behave [as 别名]
# 或者: from behave import then [as 别名]
def step_impl6(context):
    # Since using kafka offset storage, lowmark is 0, then a rewind to lowmark
    # will remove the consumer group from kafka
    assert "Current Offset" not in context.output 
开发者ID:Yelp,项目名称:kafka-utils,代码行数:6,代码来源:offset_rewind.py

示例3: test_mode_environment_check

# 需要导入模块: import behave [as 别名]
# 或者: from behave import then [as 别名]
def test_mode_environment_check(context):
    """Test that the SIMQLE_MODE env variable switches the connections."""
    # When there is no SIMQLE_MODE set, production mode is used by default
    assert os.getenv("SIMQLE_MODE", None) is None

    production_manager = ConnectionManager()
    production_engine = production_manager.get_engine("my-sqlite-database")
    production_url = str(production_engine.url)

    assert production_url == "sqlite:////tmp/production-database.db"


    # when SIMQLE_MODE is "production", then production mode is active
    os.environ["SIMQLE_MODE"] = "production"

    production_manager = ConnectionManager()
    production_engine = production_manager.get_engine("my-sqlite-database")
    production_url = str(production_engine.url)

    assert production_url == "sqlite:////tmp/production-database.db"


    # when SIMQLE_MODE is "development", then development mode is active
    os.environ["SIMQLE_MODE"] = "development"
    development_manager = ConnectionManager()
    development_engine = development_manager.get_engine("my-sqlite-database")
    development_url = str(development_engine.url)

    assert development_url == "sqlite:////tmp/development-database.db"

    # when SIMQLE_MODE is "testing", then testing mode is active
    os.environ["SIMQLE_MODE"] = "testing"
    development_manager = ConnectionManager()
    development_engine = development_manager.get_engine("my-sqlite-database")
    development_url = str(development_engine.url)

    assert development_url == "sqlite:////tmp/test-database.db"


    # del SIMQLE_MODE for the next test
    del os.environ["SIMQLE_MODE"] 
开发者ID:Harlekuin,项目名称:SimQLe,代码行数:43,代码来源:connection-mode.py


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