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 Granulate 36 """ 37 38 import sys, unittest 39 import re, time,os 40 from nsi.granulate import Granulate 41 42 43 filePath = os.path.join(os.path.dirname(__file__), 'data', 'test.odt') 44 45 try: 46 filedata = open(filePath, 'rb').read() 47 except IOError: 48 print "File not found" 49 sys.exit(1) 50 5153 54102 103 #def testAllMethodsGranulateObj(self): 104 # """ 105 # This test all methods. 106 # """ 107 # t1 = time.time() 108 # #import pdb; pdb.set_trace() 109 # granObj = self.createInstanceGraOffice() 110 # self.failUnless(granObj is not None) 111 # resultDict = granObj.granulateDocument() 112 # self.assertEquals(len(resultDict['image_list']), 26) 113 # self.assertEquals(len(resultDict['table_list']), 1) 114 # 115 # resultDictTable = granObj.getTableDocumentList() 116 # self.assertEquals(len(resultDictTable['table_list']), 1) 117 # 118 # resultDictImage = granObj.getImageDocumentList() 119 # self.assertEquals(len(resultDictImage['image_list']), 26) 120 # 121 # resultDictThumbnails = granObj.getThumbnailsDocument() 122 # self.failUnless(resultDictThumbnails['thumbnails'] is not None) 123 # 124 # resultDictSummary = granObj.getSummaryDocument() 125 # self.failUnless(resultDictSummary['summary'] is None) 126 # 127 # print (time.time() -t1)/(24*3600) 128 129 130 if __name__=='__main__': 131 tests=(TestGranulate,) 132 for t in tests: 133 suite = unittest.makeSuite(t) 134 unittest.TextTestRunner(verbosity=2).run(suite) 13556 """ 57 This test passes arguments the old way. 58 """ 59 t1 = time.time() 60 resultDict = Granulate().granulateDocument(filename='teste.odt', data=filedata) 61 self.assertEquals(len(resultDict['image_list']), 26) 62 self.assertEquals(len(resultDict['table_list']), 1) 63 print (time.time() -t1)/(24*3600)6466 """ 67 This test passes arguments the old way. 68 """ 69 t1 = time.time() 70 resultList = Granulate().getTableDocumentList(filename='teste.odt', data=filedata) 71 self.assertEquals(len(resultList), 1) 72 print (time.time() -t1)/(24*3600)7375 """ 76 This test passes arguments the old way. 77 """ 78 t1 = time.time() 79 resultList = Granulate().getImageDocumentList(filename='teste.odt', data=filedata) 80 self.assertEquals(len(resultList), 26) 81 print (time.time() -t1)/(24*3600)8284 """ 85 This test passes arguments the old way. 86 """ 87 t1 = time.time() 88 result = Granulate().getThumbnailsDocument(filename='teste.odt', data=filedata) 89 self.failUnless(result is not None) 90 #self.assertEquals(resultDict['thumbnails'], is instance) 91 print (time.time() -t1)/(24*3600)9294 """ 95 This test passes arguments the old way. 96 """ 97 t1 = time.time() 98 resultList = Granulate().getSummaryDocument(filename='teste.odt', data=filedata) 99 self.failUnless(resultList is None) 100 #self.assertEquals(resultDict['summary'], None) 101 print (time.time() -t1)/(24*3600)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Jun 2 15:41:55 2016 | http://epydoc.sourceforge.net |