@pytest.mark.parametrize("test_input, expected", [("3+5",8), ("2+4",6), ("6*9",42, marks=pytest.mark.xfail),]) deftest_eval(test_input, expected): asserteval(test_input)==expected 運(yùn)行結(jié)果如下: $ pytest === test session starts === platform linux ‐‐ Python 3.x.y, pyt...
www.dbjr.com.cn/python/328829r...htm 2025-5-28