當前位置: 首頁>>代碼示例>>Python>>正文


Python OpenEndedChild.sanitize_html方法代碼示例

本文整理匯總了Python中xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild.sanitize_html方法的典型用法代碼示例。如果您正苦於以下問題:Python OpenEndedChild.sanitize_html方法的具體用法?Python OpenEndedChild.sanitize_html怎麽用?Python OpenEndedChild.sanitize_html使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild的用法示例。


在下文中一共展示了OpenEndedChild.sanitize_html方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_combined

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_combined(self):
     """
     tests a combination of inputs
     """
     test_input = u"{}\n{}\n{}\n\n{}{}\n{}".format(self.link_text,
                                                   self.text,
                                                   self.script_dirty,
                                                   self.embed_dirty,
                                                   self.text_lessthan_noencd,
                                                   self.img_dirty)
     test_output = u"{}<br/>{}<br/>{}<br/><br/>{}{}<br/>{}".format(self.link_atag,
                                                                   self.text,
                                                                   self.script_clean,
                                                                   self.embed_clean,
                                                                   self.text_lessthan_encode,
                                                                   self.img_clean)
     self.assertEqual(OpenEndedChild.sanitize_html(test_input), test_output)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:19,代碼來源:test_combined_open_ended.py

示例2: test_linkify

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_linkify(self):
     """
     tests the replace_newlines function
     """
     self.assertEqual(OpenEndedChild.sanitize_html(self.link_text), self.link_atag)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:7,代碼來源:test_combined_open_ended.py

示例3: test_lessthan

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_lessthan(self):
     """
     Tests that `<` in text context is handled properly
     """
     self.assertEqual(OpenEndedChild.sanitize_html(self.text_lessthan_noencd), self.text_lessthan_encode)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:7,代碼來源:test_combined_open_ended.py

示例4: test_text

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_text(self):
     """
     Test for passing through text unchanged, including unicode
     """
     self.assertEqual(OpenEndedChild.sanitize_html(self.text), self.text)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:7,代碼來源:test_combined_open_ended.py

示例5: test_iframe

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_iframe(self):
     """
     Basic test for passing through iframe, but stripping bad attr
     """
     self.assertEqual(OpenEndedChild.sanitize_html(self.iframe_dirty), self.iframe_clean)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:7,代碼來源:test_combined_open_ended.py

示例6: test_embed

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_embed(self):
     """
     Basic test for passing through embed, but stripping bad attr
     """
     self.assertEqual(OpenEndedChild.sanitize_html(self.embed_dirty), self.embed_clean)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:7,代碼來源:test_combined_open_ended.py

示例7: test_script

# 需要導入模塊: from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild [as 別名]
# 或者: from xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild import sanitize_html [as 別名]
 def test_script(self):
     """
     Basic test for stripping <script>
     """
     self.assertEqual(OpenEndedChild.sanitize_html(self.script_dirty), self.script_clean)
開發者ID:Gfirey,項目名稱:edx-platform,代碼行數:7,代碼來源:test_combined_open_ended.py


注:本文中的xmodule.open_ended_grading_classes.openendedchild.OpenEndedChild.sanitize_html方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。