0
嘗試使用pytest的特徵通過PARAMS = []到燈具的裝飾期待它被單獨地調用爲每個傳遞的值的。作爲PARAM我想通過另一個夾具(只是一個演示代碼):通過夾具作爲另一燈具的裝飾PARAMS
import pytest
@pytest.fixture
def rates():
return (1.12, 1.15, 1.37)
@pytest.fixture
def expires():
return (102, 105, 107)
@pytest.fixture(params=[rates, expires])
def data(request):
return request.param
def test_vol(data):
assert len(data) == 3
這只是失敗,並抱怨:
TypeError: object of type 'function' has no len()
是有辦法做到這一點?