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')
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)
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'))
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' ))
def test_codeblock(self): style = ReSTStyle(ReSTDocument()) style.codeblock('foobar') self.assertEqual(style.doc.getvalue(), six.b('::\n\n foobar\n\n\n'))
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>`'))
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'))
def test_code(self): style = ReSTStyle(ReSTDocument()) style.code('foobar') self.assertEqual(style.doc.getvalue(), six.b('``foobar`` '))
def test_italics(self): style = ReSTStyle(ReSTDocument()) style.italics('foobar') self.assertEqual(style.doc.getvalue(), six.b('*foobar* '))
def test_bold(self): style = ReSTStyle(ReSTDocument()) style.bold('foobar') self.assertEqual(style.doc.getvalue(), six.b('**foobar** '))