Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 546 Bytes

PT018.md

File metadata and controls

34 lines (23 loc) · 546 Bytes

PT018

assertion should be broken down into multiple parts

This violation is reported when the plugin encounter an assertion on multiple conditions.

Examples

Bad code:

def test_foo():
    assert something and something_else

def test_bar():
    assert not (something or something_else)

Good code:

def test_foo():
    assert something
    assert something_else

def test_bar():
    assert not something
    assert not something_else

Rationale

  • to make it easier to understand and debug test failures