<2>pytest:简单示例
python文件:demo.py
# content of test_sample.py
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 5
运行方法
在终端中,执行pytest demo.py
python文件:demo.py
# content of test_sample.py
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 5
在终端中,执行pytest demo.py