标签:one led inpu actual cli expected ted fail enc
import pytest
@pytest.mark.parametrize(‘test_input,expected‘,[(‘3+5‘,8),
(‘2-1‘,1),(‘7*5‘,30)])
def test_eval(test_input,expected):
assert eval(test_input)==expected ----eval把字符串转换成表达式
est_param.py::test_eval[2-1-1]
test_param.py::test_eval[7*5-30] PASSED [ 33%]PASSED [ 66%]FAILED [100%]
test_param.py:3 (test_eval[7*5-30])
35 != 30
Expected :30
Actual :35
<Click to see difference>
test_input = ‘7*5‘, expected = 30
@pytest.mark.parametrize(‘test_input,expected‘,[(‘3+5‘,8),
(‘2-1‘,1),(‘7*5‘,30)])
def test_eval(test_input,expected):
> assert eval(test_input)==expected
E assert 35 == 30 ----提示把30改成35
test_param.py:7: AssertionError
Assertion failed
标签:one led inpu actual cli expected ted fail enc
原文地址:https://www.cnblogs.com/QaStudy/p/11565438.html