class documentation

class CheckerTestCase: (source)

View In Hierarchy

A base testcase class for unit testing individual checker classes.

Method assertAddsMessages Assert that exactly the given method adds the given messages.
Method assertNoMessages Assert that no messages are added by the given method.
Method setup_method Undocumented
Method walk Recursive walk on the given node.
Constant CHECKER_CLASS Undocumented
Constant CONFIG Undocumented
Instance Variable checker Undocumented
Instance Variable linter Undocumented
@contextlib.contextmanager
def assertAddsMessages(self, *messages: MessageTest, ignore_position: bool = False) -> Generator[None, None, None]: (source)

Assert that exactly the given method adds the given messages. The list of messages must exactly match *all* the messages added by the method. Additionally, we check to see whether the args in each message can actually be substituted into the message string. Using the keyword argument `ignore_position`, all checks for position arguments (line, col_offset, ...) will be skipped. This can be used to just test messages for the correct node.

@contextlib.contextmanager
def assertNoMessages(self) -> Iterator[None]: (source)

Assert that no messages are added by the given method.

def setup_method(self): (source)

Undocumented

def walk(self, node: nodes.NodeNG): (source)

Recursive walk on the given node.

CHECKER_CLASS: Any = (source)

Undocumented

CONFIG: dict[str, Any] = (source)

Undocumented

Value
{}

Undocumented

Undocumented