def test_strip_tags_only_single_spaces(self): # concatenated spaces are reduced to a single one. result = strip_tags("foo bar \nbaz") self.assertEqual("foo bar baz", result)
def test_strip_tags_result_stripped(self): # leading/trailing whitespaces are stripped from result result = strip_tags(" foo bar \n ") self.assertEqual("foo bar", result)
def test_strip_tags_no_linebreak(self): # linebreaks are removed from HTML result = strip_tags("foo\nbar\nbaz") self.assertEqual("foo bar baz", result)
def test_strip_tags_no_content(self): # HTML w/o any tags is handled correctly result = strip_tags("Hi there!") self.assertEqual("Hi there!", result)
def test_strip_tags_non_ascii(self): # we handle non-ASCII chars correctly result = strip_tags("<div>ä</div>") self.assertEqual("ä", result)
def test_strip_tags_nested(self): # we can strip tags from nested HTML result = strip_tags("<div>foo<div>bar</div>baz</div>") self.assertEqual("foobarbaz", result)
def test_strip_tags_simple(self): # simple one-leveled docs are stripped correctly result = strip_tags("<div>foo</div>") self.assertEqual("foo", result)