如何使用yaml

import pytest
import yaml

def func(x):
    return x + 1

@pytest.mark.parametrize(["a","b"],yaml.safe_load(open("./data.yaml")))
def test_answer(a,b):
    assert func(a) == b

 

 

 

posted @ 2021-12-10 16:01  feifei_tian  阅读(37)  评论(0编辑  收藏  举报