pytest-composite-assertion (PT018)
源自 flake8-pytest-style linter。
有时提供修复。
作用
检查组合了多个独立条件的断言。
为什么这不好?
复合断言语句在失败时更难调试,因为失败消息不会指示哪个条件失败。
示例
def test_foo():
assert something and something_else
def test_bar():
assert not (something or something_else)
建议改为