周志洋

个人站

持续学习 才能不被淘汰


Python实用技巧-pytest 测试框架

基本测试

def test_add():
   assert add(2, 3) == 5

fixture 使用

import pytest

@pytest.fixture
def sample_data():
   return [1, 2, 3, 4, 5]

def test_sum(sample_data):
   assert sum(sample_data) == 15


转载请注明:周志洋的博客 » Python实用技巧-pytest 测试框架

打赏一个呗

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦