#NEWLINE# def test_buildWithPolicy( self ) : #NEWLINE# #INDENT# '\n        L{BuildAPIDocsScript.buildAPIDocs} builds the API docs with values\n        appropriate for the Twisted project.\n        ' #NEWLINE# stdout = StringIO ( ) #NEWLINE# self . patch ( sys , 'stdout' , stdout ) #NEWLINE# docstring = 'text in docstring' #NEWLINE# projectRoot = FilePath ( self . mktemp ( ) ) #NEWLINE# packagePath = projectRoot . child ( 'twisted' ) #NEWLINE# packagePath . makedirs ( ) #NEWLINE# packagePath . child ( '__init__.py' ) . setContent ( ( "def foo():\n    '%s'\n" % ( docstring , ) ) ) #NEWLINE# packagePath . child ( '_version.py' ) . setContent ( genVersion ( 'twisted' , 1 , 0 , 0 ) ) #NEWLINE# outputPath = FilePath ( self . mktemp ( ) ) #NEWLINE# script = BuildAPIDocsScript ( ) #NEWLINE# script . buildAPIDocs ( projectRoot , stdout ) #NEWLINE# indexPath = outputPath . child ( 'index.html' ) #NEWLINE# self . assertTrue ( indexPath . exists ( ) , ( 'API index %r did not exist.' % ( outputPath . path , ) ) ) #NEWLINE# self . assertIn ( '<a href="http://twistedmatrix.com/">Twisted</a>' , indexPath . getContent ( ) , 'Project name/location not in file contents.' ) #NEWLINE# twistedPath = outputPath . child ( 'twisted.html' ) #NEWLINE# self . assertTrue ( twistedPath . exists ( ) , ( 'Package documentation file %r did not exist.' % ( twistedPath . path , ) ) ) #NEWLINE# self . assertIn ( docstring , twistedPath . getContent ( ) , 'Docstring not in package documentation file.' ) #NEWLINE# self . assertIn ( '<a href="http://twistedmatrix.com/trac/browser/tags/releases/twisted-1.0.0/twisted">View Source</a>' , twistedPath . getContent ( ) ) #NEWLINE# self . assertEqual ( stdout . getvalue ( ) , '' )