本文整理汇总了Python中botocore.docs.bcdoc.style.ReSTStyle类的典型用法代码示例。如果您正苦于以下问题:Python ReSTStyle类的具体用法?Python ReSTStyle怎么用?Python ReSTStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReSTStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sphinx_py_method_with_params
def test_sphinx_py_method_with_params(self):
style = ReSTStyle(ReSTDocument())
style.start_sphinx_py_method('method', 'foo=None')
style.end_sphinx_py_method()
self.assertEqual(
style.doc.getvalue(),
six.b('\n\n.. py:method:: method(foo=None)\n\n \n\n'))
示例2: test_examples
def test_examples(self):
style = ReSTStyle(ReSTDocument())
self.assertTrue(style.doc.keep_data)
style.start_examples()
self.assertFalse(style.doc.keep_data)
style.end_examples()
self.assertTrue(style.doc.keep_data)
示例3: test_escape_href_link
def test_escape_href_link(self):
style = ReSTStyle(ReSTDocument())
style.start_a(attrs=[('href', 'http://example.org')])
style.doc.write('foo: the next bar')
style.end_a()
self.assertEqual(
style.doc.getvalue(),
six.b('`foo\\: the next bar <http://example.org>`__ '))
示例4: test_internal_link
def test_internal_link(self):
style = ReSTStyle(ReSTDocument())
style.doc.target = 'html'
style.internal_link('MyLink', '/index')
self.assertEqual(
style.doc.getvalue(),
six.b(':doc:`MyLink </index>`')
)
示例5: test_toctree_man
def test_toctree_man(self):
style = ReSTStyle(ReSTDocument())
style.doc.target = 'man'
style.toctree()
style.tocitem('foo')
style.tocitem('bar')
self.assertEqual(style.doc.getvalue(),
six.b('\n\n\n* foo\n\n\n* bar\n\n'))
示例6: test_href_link
def test_href_link(self):
style = ReSTStyle(ReSTDocument())
style.start_a(attrs=[('href', 'http://example.org')])
style.doc.write('example')
style.end_a()
self.assertEqual(
style.doc.getvalue(),
six.b('`example <http://example.org>`__ ')
)
示例7: test_write_py_doc_string
def test_write_py_doc_string(self):
style = ReSTStyle(ReSTDocument())
docstring = (
'This describes a function\n'
':param foo: Describes foo\n'
'returns: None'
)
style.write_py_doc_string(docstring)
self.assertEqual(style.doc.getvalue(), six.b(docstring + '\n'))
示例8: test_hidden_toctree_non_html
def test_hidden_toctree_non_html(self):
style = ReSTStyle(ReSTDocument())
style.doc.target = 'man'
style.hidden_toctree()
style.hidden_tocitem('foo')
style.hidden_tocitem('bar')
self.assertEqual(
style.doc.getvalue(),
six.b(''))
示例9: test_hidden_toctree_html
def test_hidden_toctree_html(self):
style = ReSTStyle(ReSTDocument())
style.doc.target = 'html'
style.hidden_toctree()
style.hidden_tocitem('foo')
style.hidden_tocitem('bar')
self.assertEqual(
style.doc.getvalue(),
six.b('\n.. toctree::\n :maxdepth: 1'
'\n :hidden:\n\n foo\n bar\n'))
示例10: __init__
def __init__(self, target='man'):
self.style = ReSTStyle(self)
self.target = target
self.parser = DocStringParser(self)
self.keep_data = True
self.do_translation = False
self.translation_map = {}
self.hrefs = {}
self._writes = []
self._last_doc_string = None
示例11: test_new_line
def test_new_line(self):
style = ReSTStyle(ReSTDocument())
style.new_line()
self.assertEqual(style.doc.getvalue(), six.b('\n'))
style.do_p = False
style.new_line()
self.assertEqual(style.doc.getvalue(), six.b('\n\n'))
示例12: test_sphinx_py_attr
def test_sphinx_py_attr(self):
style = ReSTStyle(ReSTDocument())
style.start_sphinx_py_attr('Foo')
style.end_sphinx_py_attr()
self.assertEqual(style.doc.getvalue(),
six.b('\n\n.. py:attribute:: Foo\n\n \n\n'))
示例13: test_ref
def test_ref(self):
style = ReSTStyle(ReSTDocument())
style.ref('foobar', 'http://foo.bar.com')
self.assertEqual(style.doc.getvalue(),
six.b(':doc:`foobar <http://foo.bar.com>`'))
示例14: test_code
def test_code(self):
style = ReSTStyle(ReSTDocument())
style.code('foobar')
self.assertEqual(style.doc.getvalue(), six.b('``foobar`` '))
示例15: test_italics
def test_italics(self):
style = ReSTStyle(ReSTDocument())
style.italics('foobar')
self.assertEqual(style.doc.getvalue(), six.b('*foobar* '))