Esempio n. 1
0
 def testPipePager(self):
     class MockStdout(object):
         "Dummy doc string"
         isatty = lambda x: True
         write = lambda x, y: None
     def goodPager(*args, **kwargs):
         self.called = True
     def badPager(*args, **kwargs):
         raise RuntimeError("Text pager should not have been called")
     self.called = False
     self.mock(sys, 'stdout', MockStdout())
     self.mock(pydoc, 'pager', badPager)
     self.mock(pydoc, 'pipepager', goodPager)
     explain._formatDoc('Stdout', MockStdout)
Esempio n. 2
0
 def testFormatDoc(self):
     'test various formatting: reindent, headers, tags'
     class MockStdout(object):
         """
         NAME
         ====
         B{Dummy} {doc} I{string} B{with B{nested} text}
         """
         isatty = lambda x: False
         write = lambda x, y: None
     def mockPager(text):
         refText = (
           'Conary API Documentation: \x1b[1mStdout.MockStdout\x1b[21m\n\n'
           '\x1b[1mNAME\x1b[21m\n'
           '    \x1b[1mDummy\x1b[21m {doc} \x1b[7mstring\x1b[27m \x1b[1mwith nested text\x1b[21m\n    ')
         self.assertEquals(text, refText)
     self.mock(sys, 'stdout', MockStdout())
     self.mock(pydoc, 'pager', mockPager)
     explain._formatDoc('Stdout', MockStdout)