pytest---参数化
发布时间:2020-12-14 00:24:03 所属栏目:Linux 来源:网络整理
导读: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_
import pytest est_param.py::test_eval[2-1-1] Expected :30 test_input = ‘7*5‘,expected = 30 @pytest.mark.parametrize(‘test_input, test_param.py:7: AssertionError Assertion failed (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |