常用断言方式有以下几种:
assert xx 判断xx为真
assert not xx 判断xx不为真
assert a in b 判断b包含a
assert a == b 判断a 等于 b
assert a!=b 判断a不等于b
实例:
@pytest.mark.parametrize("test_input, excepted", [
("3+5", 8),
("1+4", 5),
], ids=['test1', 'test2'])
def test_eval(test_input, excepted):
assert eval(test_input) == excepted