Module EDTestCaseEDUtilsImage
[hide private]
[frames] | no frames]

Source Code for Module EDTestCaseEDUtilsImage

  1  ## 
  2  #    Project: The EDNA Kernel 
  3  #             http://www.edna-site.org 
  4  # 
  5  #    File: "$Id$" 
  6  # 
  7  #    Copyright (C) 2008-2010 European Synchrotron Radiation Facility 
  8  #                            Grenoble, France 
  9  # 
 10  #    Principal authors: Marie-Francoise Incardona (incardon@esrf.fr) 
 11  #                       Olof Svensson (svensson@esrf.fr)  
 12  #                        Jerome Kieffer 
 13  # 
 14  #    This program is free software: you can redistribute it and/or modify 
 15  #    it under the terms of the GNU Lesser General Public License as published 
 16  #    by the Free Software Foundation, either version 3 of the License, or 
 17  #    (at your option) any later version. 
 18  # 
 19  #    This program is distributed in the hope that it will be useful, 
 20  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
 21  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 22  #    GNU Lesser General Public License for more details. 
 23  # 
 24  #    You should have received a copy of the GNU General Public License 
 25  #    and the GNU Lesser General Public License  along with this program.   
 26  #    If not, see <http://www.gnu.org/licenses/>. 
 27  # 
 28   
 29  __authors__ = ["Marie-Francoise Incardona", "Olof Svensson", "Jerome Kieffer"] 
 30  __contact__ = "svensson@esrf.eu" 
 31  __license__ = "LGPLv3+" 
 32  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
 33   
 34  import os 
 35   
 36  from EDVerbose import EDVerbose 
 37  from EDUtilsImage import EDUtilsImage 
 38  from EDTestCase   import EDTestCase 
 39  from EDAssert     import EDAssert 
 40   
 41   
42 -class EDTestCaseEDUtilsImage(EDTestCase):
43 44
45 - def __init__(self, _strTestName=None):
46 EDTestCase.__init__(self, _strTestName) 47 self.__edConfiguration = None 48 edStrDataDir = "images" 49 self.__edStrDataPath = os.path.join(self.getTestsDataHome(), edStrDataDir) 50 self.__strFileName = "ref-testscale_1_001.img" 51 self.__strFilePath = os.path.join(self.__edStrDataPath, self.__strFileName)
52 53
54 - def testGetImageNumber(self):
55 """ 56 Testing retrieving the image number from a image filename 57 """ 58 iImageNumber = EDUtilsImage.getImageNumber(self.__strFileName) 59 iReference = 1 60 EDAssert.equal(iReference, iImageNumber)
61 62
63 - def testGetTemplateHash(self):
64 """ 65 Testing retrieving the image number from a image filename 66 """ 67 strSymbol = "#" 68 strTemplate = EDUtilsImage.getTemplate(self.__strFileName) 69 strTemplateReference = "ref-testscale_1_###.img" 70 EDAssert.equal(strTemplateReference, strTemplate)
71 72
74 """ 75 Testing retrieving the image number from a image filename 76 """ 77 strSymbol = "?" 78 strTemplate = EDUtilsImage.getTemplate(self.__strFileName, strSymbol) 79 strTemplateReference = "ref-testscale_1_???.img" 80 EDAssert.equal(strTemplateReference, strTemplate)
81 82 83 84 ############################################################################## 85
86 - def process(self):
92 93 94 95 ############################################################################## 96 97 if __name__ == '__main__': 98 99 edTestCaseEDUtilsImage = EDTestCaseEDUtilsImage("TestCase EDTestCaseEDUtilsImage") 100 edTestCaseEDUtilsImage.execute() 101