Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def test_strip_tags_no_linebreak(self):
     # linebreaks are removed from HTML
     result = strip_tags("foo\nbar\nbaz")
     self.assertEqual("foo bar baz", result)
Example #4
0
 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)
Example #5
0
 def test_strip_tags_non_ascii(self):
     # we handle non-ASCII chars correctly
     result = strip_tags("<div>ä</div>")
     self.assertEqual("ä", result)
Example #6
0
 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)
Example #7
0
 def test_strip_tags_simple(self):
     # simple one-leveled docs are stripped correctly
     result = strip_tags("<div>foo</div>")
     self.assertEqual("foo", result)