Exemple #1
0
 def __init__(self, session, obj, command_table, arg_table):
     self.session = session
     self.obj = obj
     self.command_table = command_table
     self.arg_table = arg_table
     self.renderer = get_renderer()
     self.doc = ReSTDocument(target='man')
Exemple #2
0
 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)
Exemple #3
0
 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'))
Exemple #4
0
 def test_toctree_html(self):
     style = ReSTStyle(ReSTDocument())
     style.doc.target = 'html'
     style.toctree()
     style.tocitem('foo')
     style.tocitem('bar')
     self.assertEqual(
         style.doc.getvalue(),
         six.
         b('\n.. toctree::\n  :maxdepth: 1\n  :titlesonly:\n\n  foo\n  bar\n'
           ))
Exemple #5
0
 def test_codeblock(self):
     style = ReSTStyle(ReSTDocument())
     style.codeblock('foobar')
     self.assertEqual(style.doc.getvalue(), six.b('::\n\n  foobar\n\n\n'))
Exemple #6
0
 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>`'))
Exemple #7
0
 def test_h3(self):
     style = ReSTStyle(ReSTDocument())
     style.h3('foobar fiebaz')
     self.assertEqual(
         style.doc.getvalue(),
         six.b('\n\n-------------\nfoobar fiebaz\n-------------\n\n'))
Exemple #8
0
 def test_code(self):
     style = ReSTStyle(ReSTDocument())
     style.code('foobar')
     self.assertEqual(style.doc.getvalue(), six.b('``foobar`` '))
Exemple #9
0
 def test_italics(self):
     style = ReSTStyle(ReSTDocument())
     style.italics('foobar')
     self.assertEqual(style.doc.getvalue(), six.b('*foobar* '))
Exemple #10
0
 def test_bold(self):
     style = ReSTStyle(ReSTDocument())
     style.bold('foobar')
     self.assertEqual(style.doc.getvalue(), six.b('**foobar** '))