Assert with the assert
statement
Assertions about expected exceptions
Assertions about expected warnings
Making use of context-sensitive comparisons
Defining your own explanation for failed assertions
Assertion introspection details
Assertion rewriting caches files on disk
Pytest使用Python内置的assert的方法,并可以报告常见表达式的值。
如果要判断预期的异常,可以使用pytest.raises()
,对于预期的警告,可以使用pyesy.warns