pytest中,fixture的scope可以设置的级别
摘要:function:默认值,表示fixture将在测试函数被调用时执行,并且它们每个测试函数都会运行一次。 @pytest.fixture() def my_fixture(): # setup code here yield # teardown code here class:表示fixture将
阅读全文
posted @
2023-05-20 17:34
peijiao
阅读(92)
推荐(0) 编辑
python中常见的字符串格式化方法
摘要:1. 使用 % 符号进行字符串格式化 使用 % 符号是一种较为传统的字符串格式化方法。它通过将占位符 %s 插入到字符串中,再使用 % 运算符将具体的值插入到这些占位符中。例如: name = "Alice" age = 20 height = 175 print("My name is %s, I
阅读全文
posted @
2023-05-20 17:24
peijiao
阅读(115)
推荐(0) 编辑