当前位置: 首页>>代码示例>>Python>>正文


Python etree.RootTreeNode类代码示例

本文整理汇总了Python中skcode.etree.RootTreeNode的典型用法代码示例。如果您正苦于以下问题:Python RootTreeNode类的具体用法?Python RootTreeNode怎么用?Python RootTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RootTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_render_text_is_important

 def test_render_text_is_important(self):
     """ Test the ``render_text`` method with a "important" flag. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('notabene', NotaBeneTreeNode, attrs={'important': ''})
     output_result = tree_node.render_text('test\ntest2\n')
     expected_result = 'N.B. test\ntest2\n\n'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_notabene.py

示例2: test_render_text

 def test_render_text(self):
     """ Test the ``render_text`` method. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('code', CodeBlockTreeNode, attrs={'code': 'python'}, content='# Hello World!')
     output_result = tree_node.render_text('')
     expected_result = '1.   # Hello World!\n'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_codeblocks.py

示例3: test_render_text_with_default_language

 def test_render_text_with_default_language(self):
     """ Test the ``render_text`` method with the default language set. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('code', CodeBlockTreeNode, attrs={}, content='# Hello World!')
     output_result = tree_node.render_text('')
     expected_result = '1.   # Hello World!\n'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_codeblocks.py

示例4: test_text_rendering_only_whitespaces

 def test_text_rendering_only_whitespaces(self):
     """ Test text rendering with no text. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('not', NotNotationTreeNode)
     rendered_output = tree_node.render_text('    ')
     expected_output = ''
     self.assertEqual(expected_output, rendered_output)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_electronic.py

示例5: test_get_source_link_url

 def test_get_source_link_url(self):
     """ Test the ``get_source_link_url`` method with the "src" attribute set. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('code', CodeBlockTreeNode,
                                          attrs={'src': 'https://github.com/TamiaLab/PySkCode'})
     src_link_url = tree_node.get_source_link_url()
     self.assertEqual('https://github.com/TamiaLab/PySkCode', src_link_url)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_codeblocks.py

示例6: test_text_rendering

 def test_text_rendering(self):
     """ Test text rendering. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('noparse', NoParseTreeNode, content='[u]... some text[/u]')
     rendered_output = tree_node.render_text('')
     expected_output = '[u]... some text[/u]'
     self.assertEqual(expected_output, rendered_output)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_internalspecials.py

示例7: test_html_rendering

 def test_html_rendering(self):
     """ Test HTML rendering. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('not', NotNotationTreeNode)
     rendered_output = tree_node.render_html('RESET')
     expected_output = '<span style="text-decoration:overline; text-transform: uppercase;">RESET</span>'
     self.assertEqual(expected_output, rendered_output)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_electronic.py

示例8: test_render_text_without_video

 def test_render_text_without_video(self):
     """ Test the ``render_text`` method without a valid video ID. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('youtube', YoutubeTreeNode)
     output_result = tree_node.render_text('test')
     expected_result = 'test'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_medias.py

示例9: test_render_html

 def test_render_html(self):
     """ Test the ``render_html`` method. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('task', TodoTaskTreeNode)
     output_result = tree_node.render_html('test')
     expected_result = '<li class="task_pending">test</li>\n'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_todolists.py

示例10: test_get_youtube_video_id_path_2

    def test_get_youtube_video_id_path_2(self):
        """ Test the ``get_youtube_video_id`` method with a valid youtube link. """

        root_tree_node = RootTreeNode()
        tree_node = root_tree_node.new_child('youtube', YoutubeTreeNode, content='https://youtu.be/something/dQw4w9WgXcQ')
        video_id = tree_node.get_youtube_video_id()
        self.assertEqual('dQw4w9WgXcQ', video_id)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_medias.py

示例11: test_render_text

 def test_render_text(self):
     """ Test the ``render_text`` method. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('youtube', YoutubeTreeNode, content='https://www.youtube.com/watch?v=dQw4w9WgXcQ')
     output_result = tree_node.render_text('test')
     expected_result = 'https://youtu.be/dQw4w9WgXcQ'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_medias.py

示例12: test_render_text_with_no_src_link

 def test_render_text_with_no_src_link(self):
     """ Test the ``render_text`` method without a source link. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('img', ImageTreeNode, attrs={})
     output_result = tree_node.render_text('test')
     expected_result = 'test'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_medias.py

示例13: test_render_html_with_no_src_link

 def test_render_html_with_no_src_link(self):
     """ Test the ``render_html`` method without a source link. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('img', ImageTreeNode, attrs={}, content='')
     output_result = tree_node.render_html('test')
     expected_result = '<img src="" />'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_medias.py

示例14: test_render_text

 def test_render_text(self):
     """ Test the ``render_text`` method with a valid color. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('color', ColorTextTreeNode, attrs={'color': '#FFFFFF'})
     output_result = tree_node.render_text('Hello World!')
     expected_result = 'Hello World!'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_textcolors.py

示例15: test_render_html_is_done

 def test_render_html_is_done(self):
     """ Test the ``render_html`` method with a "done" task. """
     root_tree_node = RootTreeNode()
     tree_node = root_tree_node.new_child('task', TodoTaskTreeNode, attrs={'done': ''})
     output_result = tree_node.render_html('test')
     expected_result = '<li class="task_done">test</li>\n'
     self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_todolists.py


注:本文中的skcode.etree.RootTreeNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。