def text_assert(self, anchor, byte=False):
        """
        If `anchor` is not found then raise `DataNotFound` exception.
        """

        if not self.text_search(anchor, byte=byte):
            raise DataNotFound(u'Substring not found: %s' % anchor)
def text_assert ( self , anchor , byte = False ) : if not self . text_search ( anchor , byte = byte ) : raise DataNotFound ( u'Substring not found: %s' % anchor )
If `anchor` is not found then raise `DataNotFound` exception.