class documentation
class CheckerTestCase: (source)
A base testcase class for unit testing individual checker classes.
Method | assert |
Assert that exactly the given method adds the given messages. |
Method | assert |
Assert that no messages are added by the given method. |
Method | setup |
Undocumented |
Method | walk |
Recursive walk on the given node. |
Constant | CHECKER |
Undocumented |
Constant | CONFIG |
Undocumented |
Instance Variable | checker |
Undocumented |
Instance Variable | linter |
Undocumented |
@contextlib.contextmanager
def assertAddsMessages(self, *messages:
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.