本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)