Raises :exc:`TestFailed` if the node is not matched with
        `prev_value` or `prev_index`.

def compare(self, node, prev_value=None, prev_index=None):
        """Raises :exc:`TestFailed` if the node is not matched with
        `prev_value` or `prev_index`.
        """
        if prev_value is not None and node.value != prev_value or \
           prev_index is not None and node.index != prev_index:
            raise TestFailed(index=self.index)