是否有可能有一个返回字典和数据帧的装置?
import somefile
import pytest
@pytest.fixture()
def setup():
dictionary, dataframe = somefile.get_Di_And_Df()
return(dictionary, dataframe)
def test_check(setup):
assert dictionary['movie']['action'] == 'Avengers'
assert dataframe.shape[0] == 5
最佳答案
fixture 的返回值(或产生值)实际上是在测试执行期间作为函数参数注入(inject)的对象:
def test_check(setup):
dictionary, dataframe = setup
assert dictionary['movie']['action'] == 'Avengers'
assert dataframe.shape[0] == 5
关于python - Pytest fixture 返回倍数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52305185/