def _get_summary(self): text = _inner_text(Soup(self.content)) text_len = 120 if re.search('[a-zA-Z]', text[20:50]): text_len = 240 return text[:text_len] + "..."
def test_inner_text(self): self.assertEqual('This is paragraph one.This is paragraph two.', _inner_text(self.soup.html.body))