defadd(x, y):return x + y
deftest_add():assert add(1,10)==11assert add(1,1)==2assert add(1,99)==100classTestClass:deftest_one(self):
x ="this"assert"h"in x
deftest_two(self):
x ="hello"asserthasattr(x,"hello")defthree(self):
x ="hello"asserthasattr(x,"hello")--------------
pytest_demo/test_sample.py::test_add PASSED [33%]
pytest_demo/test_sample.py::TestClass::test_one PASSED [66%]
pytest_demo/test_sample.py::TestClass::test_two FAILED [100%]