本文整理汇总了Python中_pytest.mark.MarkGenerator.world方法的典型用法代码示例。如果您正苦于以下问题:Python MarkGenerator.world方法的具体用法?Python MarkGenerator.world怎么用?Python MarkGenerator.world使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_pytest.mark.MarkGenerator
的用法示例。
在下文中一共展示了MarkGenerator.world方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pytest_mark_positional
# 需要导入模块: from _pytest.mark import MarkGenerator [as 别名]
# 或者: from _pytest.mark.MarkGenerator import world [as 别名]
def test_pytest_mark_positional(self):
mark = Mark()
def f():
pass
f = mark.world("hello")(f)
assert f.world.args[0] == "hello"
f = mark.world("world")(f)
示例2: test_pytest_mark_keywords
# 需要导入模块: from _pytest.mark import MarkGenerator [as 别名]
# 或者: from _pytest.mark.MarkGenerator import world [as 别名]
def test_pytest_mark_keywords(self):
mark = Mark()
def f():
pass
mark.world(x=3, y=4)(f)
assert f.world
assert f.world.kwargs['x'] == 3
assert f.world.kwargs['y'] == 4
示例3: test_apply_multiple_and_merge
# 需要导入模块: from _pytest.mark import MarkGenerator [as 别名]
# 或者: from _pytest.mark.MarkGenerator import world [as 别名]
def test_apply_multiple_and_merge(self):
mark = Mark()
def f():
pass
mark.world
f = mark.world(x=3)(f)
assert f.world.kwargs['x'] == 3
f = mark.world(y=4)(f)
assert f.world.kwargs['x'] == 3
assert f.world.kwargs['y'] == 4
f = mark.world(y=1)(f)
assert f.world.kwargs['y'] == 1
assert len(f.world.args) == 0
示例4: test_pytest_mark_positional_func_and_keyword
# 需要导入模块: from _pytest.mark import MarkGenerator [as 别名]
# 或者: from _pytest.mark.MarkGenerator import world [as 别名]
def test_pytest_mark_positional_func_and_keyword(self):
mark = Mark()
def f():
raise Exception
m = mark.world(f, omega="hello")
def g():
pass
assert m(g) != g
assert m(g).world.args[0] is f
assert m(g).world.kwargs["omega"] == "hello"
示例5: test_apply_multiple_and_merge
# 需要导入模块: from _pytest.mark import MarkGenerator [as 别名]
# 或者: from _pytest.mark.MarkGenerator import world [as 别名]
def test_apply_multiple_and_merge(self):
mark = Mark()
def f():
pass
mark.world
mark.world(x=3)(f)
assert f.world.kwargs["x"] == 3
mark.world(y=4)(f)
assert f.world.kwargs["x"] == 3
assert f.world.kwargs["y"] == 4
mark.world(y=1)(f)
assert f.world.kwargs["y"] == 1
assert len(f.world.args) == 0