本文整理汇总了Python中skcode.etree.RootTreeNode类的典型用法代码示例。如果您正苦于以下问题:Python RootTreeNode类的具体用法?Python RootTreeNode怎么用?Python RootTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RootTreeNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: test_get_color_value_method
def test_get_color_value_method(self):
""" Test the ``get_color_value`` method. """
cls = generate_fixed_color_text_cls('customtype')
root_tree_node = RootTreeNode()
tree_node = root_tree_node.new_child('alert', cls, attrs={})
color_value = tree_node.get_color_value()
self.assertEqual('customtype', color_value)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_textcolors.py
示例17: test_render_text_trailing_whitespaces
def test_render_text_trailing_whitespaces(self):
""" Test the ``render_text`` method. """
root_tree_node = RootTreeNode()
tree_node = root_tree_node.new_child('task', TodoTaskTreeNode)
output_result = tree_node.render_text(' test\ntest2\n ')
expected_result = '[ ] test\n test2\n'
self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_todolists.py
示例18: test_text_rendering_with_encoded_html_entities
def test_text_rendering_with_encoded_html_entities(self):
""" Test text rendering with encoded HTML entities. """
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
示例19: test_render_text_is_done
def test_render_text_is_done(self):
""" Test the ``render_text`` 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_text('test\ntest2\n')
expected_result = '[x] test\n test2\n'
self.assertEqual(expected_result, output_result)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_todolists.py
示例20: test_text_rendering_auto_upper
def test_text_rendering_auto_upper(self):
""" Test text rendering. """
root_tree_node = RootTreeNode()
tree_node = root_tree_node.new_child('not', NotNotationTreeNode)
rendered_output = tree_node.render_text('reset')
expected_output = '/RESET'
self.assertEqual(expected_output, rendered_output)
开发者ID:TamiaLab,项目名称:PySkCode,代码行数:7,代码来源:tests_electronic.py
注:本文中的skcode.etree.RootTreeNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论