예제 #1
0
 def test_strip_html(self):
     html = '<a href="" class="" style="width: 200px; height: 400px">foo</a><em></em>'
     self.assertEqual(strip_html(html, allowed_tags='a', 
         allowed_attributes='href,style', allowed_styles='width'),
         '<a href="" style="width: 200px;">foo</a>')
     self.assertEqual(strip_html(html, allowed_tags=['a'], 
         allowed_attributes=['href', 'style'], allowed_styles=['width']),
         '<a href="" style="width: 200px;">foo</a>')
예제 #2
0
 def test_strip_html(self):
     html = '<a href="" class="" style="width: 200px; height: 400px">foo</a><em></em>'
     self.assertEqual(
         strip_html(html,
                    allowed_tags='a',
                    allowed_attributes='href,style',
                    allowed_styles='width'),
         '<a href="" style="width: 200px;">foo</a>')
     self.assertEqual(
         strip_html(html,
                    allowed_tags=['a'],
                    allowed_attributes=['href', 'style'],
                    allowed_styles=['width']),
         '<a href="" style="width: 200px;">foo</a>')
예제 #3
0
 def test_strip_html(self):
     html = '<a href="" class="">foo</a><em></em>'
     self.assertEqual(strip_html(html, allowed_tags='a', allowed_attributes='href'),
                      '<a href="">foo</a>')
     self.assertEqual(strip_html(html, allowed_tags=['a'], allowed_attributes=['href']),
                      '<a href="">foo</a>')