Home | Trees | Indices | Help |
---|
|
1 #!/usr/bin/python 2 ############################################################################## 3 # 4 # Copyright (c) 2007 ISrg (NSI, CEFETCAMPOS, BRAZIL) and Contributors. 5 # All Rights Reserved. 6 # Ronaldo Amaral Santos <ronaldinho.as@gmail.com> 7 # 8 # WARNING: This program as such is intended to be used by professional 9 # programmers who take the whole responsability of assessing all potential 10 # consequences resulting from its eventual inadequacies and bugs 11 # End users who are looking for a ready-to-use solution with commercial 12 # garantees and support are strongly adviced to contract a Free Software 13 # Service Company 14 # 15 # This program is Free Software; you can redistribute it and/or 16 # modify it under the terms of the GNU General Public License 17 # as published by the Free Software Foundation; either version 2 18 # of the License, or (at your option) any later version. 19 # 20 # This program is distributed in the hope that it will be useful, 21 # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 # GNU General Public License for more details. 24 # 25 # You should have received a copy of the GNU General Public License 26 # along with this program; if not, write to the Free Software 27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 # 29 ############################################################################## 30 31 __author__ = """Ronaldo Amaral Santos <ronaldinho.as@gmail.com>""" 32 __docformat__ = 'plaintext' 33 34 """ 35 Test methods GranulatePDF 36 """ 37 38 import sys, unittest 39 import re, time,os 40 from nsi.granulate import File 41 from nsi.granulate import GranulatePDF 42 43 44 filePath = os.path.join(os.path.dirname(__file__), 'data', 'test.pdf') 45 try: 46 filedata = open(filePath, 'rb').read() 47 except IOError: 48 print "File not found" 49 sys.exit(1) 50 5153103 104 # def testAllMethodsGranulateObj(self): 105 # """ 106 # This test all methods. 107 # """ 108 # t1 = time.time() 109 # #import pdb; pdb.set_trace() 110 # granObj = self.createInstanceGraOffice() 111 # self.failUnless(granObj is not None) 112 # resultDict = granObj.granulateDocument() 113 # self.assertEquals(len(resultDict['image_list']), 26) 114 # self.assertEquals(len(resultDict['table_list']), 1) 115 116 # resultListTable = granObj.getTableDocumentList() 117 # self.assertEquals(len(resultListTable), 1) 118 119 # resultListImage = granObj.getImageDocumentList() 120 # self.assertEquals(len(resultListImage), 26) 121 122 # resultThumbnails = granObj.getThumbnailsDocument() 123 # self.failUnless(resultThumbnails is not None) 124 125 # resultListSummary = granObj.getSummaryDocument() 126 # self.failUnless(resultListSummary is None) 127 128 # print (time.time() -t1)/(24*3600) 129 130 131 if __name__=='__main__': 132 tests=(TestGranulatePDF,) 133 for t in tests: 134 suite = unittest.makeSuite(t) 135 unittest.TextTestRunner(verbosity=2).run(suite) 13655 fileDoc = File(data=filedata,filename='test.pdf') 56 granObj = GranulatePDF(fileDoc) 57 return granObj5860 """ 61 This test passes arguments the old way. 62 """ 63 t1 = time.time() 64 granObj = self.createInstanceGraPDF() 65 print (time.time() -t1)/(24*3600) 66 self.failUnless(granObj is not None) 67 self.failUnless(granObj.Document is not None)6870 """ 71 This test passes arguments the old way. 72 """ 73 t1 = time.time() 74 granObj = self.createInstanceGraPDF() 75 self.failUnless(granObj is not None) 76 resultDict = granObj.granulateDocument() 77 self.assertEquals(len(resultDict['image_list']), 1) 78 self.assertEquals(len(resultDict['table_list']), 6) 79 print len(resultDict['table_list']) 80 print (time.time() -t1)/(24*3600)8183 """ 84 This test passes arguments the old way. 85 """ 86 t1 = time.time() 87 granObj = self.createInstanceGraPDF() 88 self.failUnless(granObj is not None) 89 resultList = granObj.getTableDocumentList() 90 self.assertEquals(len(resultList), 6) 91 print (time.time() -t1)/(24*3600)9294 """ 95 This test passes arguments the old way. 96 """ 97 t1 = time.time() 98 granObj = self.createInstanceGraPDF() 99 self.failUnless(granObj is not None) 100 resultList = granObj.getImageDocumentList() 101 self.assertEquals(len(resultList), 1) 102 print (time.time() -t1)/(24*3600)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Jun 2 15:41:54 2016 | http://epydoc.sourceforge.net |