def negate_test(self, node): not_node = ast.UnaryOp(op=ast.Not(), operand=node.test) node.test = not_node return node