Method: pylint.checkers.base.basic_checker.BasicChecker.visit_assert
Calls: 130, Exceptions: 0, Paths: 4Back
Path 1: 122 calls (0.94)
Assert (122)
1@utils.only_required_for_messages("assert-on-tuple", "assert-on-string-literal")
2 def visit_assert(self, node: nodes.Assert) -> None:
3 """Check whether assert is used on a tuple or string literal."""
4 if isinstance(node.test, nodes.Tuple) and len(node.test.elts) > 0:
5 self.add_message("assert-on-tuple", node=node, confidence=HIGH)
6
7 if isinstance(node.test, nodes.Const) and isinstance(node.test.value, str):
8 if node.test.value:
9 when = "never"
10 else:
11 when = "always"
12 self.add_message("assert-on-string-literal", node=node, args=(when,))
Path 2: 6 calls (0.05)
Assert (6)
1@utils.only_required_for_messages("assert-on-tuple", "assert-on-string-literal")
2 def visit_assert(self, node: nodes.Assert) -> None:
3 """Check whether assert is used on a tuple or string literal."""
4 if isinstance(node.test, nodes.Tuple) and len(node.test.elts) > 0:
5 self.add_message("assert-on-tuple", node=node, confidence=HIGH)
6
7 if isinstance(node.test, nodes.Const) and isinstance(node.test.value, str):
8 if node.test.value:
9 when = "never"
10 else:
11 when = "always"
12 self.add_message("assert-on-string-literal", node=node, args=(when,))
Path 3: 1 calls (0.01)
Assert (1)
1@utils.only_required_for_messages("assert-on-tuple", "assert-on-string-literal")
2 def visit_assert(self, node: nodes.Assert) -> None:
3 """Check whether assert is used on a tuple or string literal."""
4 if isinstance(node.test, nodes.Tuple) and len(node.test.elts) > 0:
5 self.add_message("assert-on-tuple", node=node, confidence=HIGH)
6
7 if isinstance(node.test, nodes.Const) and isinstance(node.test.value, str):
8 if node.test.value:
9 when = "never"
10 else:
11 when = "always"
12 self.add_message("assert-on-string-literal", node=node, args=(when,))
Path 4: 1 calls (0.01)
Assert (1)
1@utils.only_required_for_messages("assert-on-tuple", "assert-on-string-literal")
2 def visit_assert(self, node: nodes.Assert) -> None:
3 """Check whether assert is used on a tuple or string literal."""
4 if isinstance(node.test, nodes.Tuple) and len(node.test.elts) > 0:
5 self.add_message("assert-on-tuple", node=node, confidence=HIGH)
6
7 if isinstance(node.test, nodes.Const) and isinstance(node.test.value, str):
8 if node.test.value:
9 when = "never"
10 else:
11 when = "always"
12 self.add_message("assert-on-string-literal", node=node, args=(when,))