"Fossies" - the Fresh Open Source Software Archive

Member "reportlab-3.5.23/tests/test_tools_pythonpoint.py" (14 Mar 2013, 1244 Bytes) of package /linux/privat/reportlab-3.5.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 """Tests for the PythonPoint tool.
    2 """
    3 from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
    4 setOutDir(__name__)
    5 import os, sys, string
    6 import unittest
    7 import reportlab
    8 
    9 class PythonPointTestCase(unittest.TestCase):
   10     "Some very crude tests on PythonPoint."
   11     def test0(self):
   12         "Test if pythonpoint.pdf can be created from pythonpoint.xml."
   13 
   14         join, dirname, isfile, abspath = os.path.join, os.path.dirname, os.path.isfile, os.path.abspath
   15         from tools.pythonpoint import pythonpoint
   16         from reportlab.lib.utils import isCompactDistro, open_for_read
   17         ppDir = dirname(pythonpoint.__file__)
   18         xml = abspath(join(ppDir, 'demos', 'pythonpoint.xml'))
   19         datafilename = 'pythonpoint.pdf'
   20         outDir = outputfile('')
   21         if isCompactDistro():
   22             xml = open_for_read(xml)
   23         pdf = join(outDir, datafilename)
   24         if isfile(pdf): os.remove(pdf)
   25         pythonpoint.process(xml, outDir=outDir, verbose=0, datafilename=datafilename)
   26         assert os.path.exists(pdf)
   27 
   28 def makeSuite():
   29     return makeSuiteForClasses(PythonPointTestCase)
   30 
   31 #noruntests
   32 if __name__ == "__main__":
   33     unittest.TextTestRunner().run(makeSuite())
   34     printLocation()