def go(self): try: FIPY = FreeImagePy.freeimage() except FreeImagePy.FreeImagePy_LibraryNotFound, ex: self.printMsg( "Error:\n %s " % str(ex) ) raw_input("Press ok for exit...") return
def go(self): try: FIPY = FreeImagePy.freeimage() except FreeImagePy.FreeImagePy_LibraryNotFound, ex: self.printMsg("Error:\n %s " % str(ex)) raw_input("Press ok for exit...") return
def setUp(self): self.freeimage = FreeImagePy.freeimage() self.bitmap = self.freeimage.genericLoader(imagePath) if self.bitmap == 0: raise IOError, "Unable to read test file" exception_value = "My value" self.exception_value = exception_value class MyException(Exception): pass self.MyException = MyException class RootFile(object): def __init__(self): self.posn = 0 class HasSeek(RootFile): def __init__(self): super(HasSeek, self).__init__() def seek(self, offset, whence): if whence == 0: self.posn = offset elif whence == 1: self.posn += offset else: raise IOError, "Unrecognized whence value %d" % whence class HasTell(RootFile): def __init__(self): super(HasTell, self).__init__() def tell(self): return self.posn class HasRead(RootFile): def __init__(self): super(HasRead, self).__init__() def read(self, n): raise IOError, "Not implemented" class NoWrite(HasSeek, HasTell): pass self.NoWrite = NoWrite class RaiseMyException(HasSeek, HasTell): def write(self, s): raise MyException, exception_value self.RaiseMyException = RaiseMyException class RaiseMemoryError(HasSeek, HasTell): def write(self, s): raise MemoryError, exception_value self.RaiseMemoryError = RaiseMemoryError
def setUp(self): self.freeimage = FreeImagePy.freeimage() exception_value = "My value" self.exception_value = exception_value class MyException(Exception): pass self.MyException = MyException class RootFile(object): def __init__(self): self.posn = 0 class HasSeek(RootFile): def __init__(self): super(HasSeek, self).__init__() def seek(self, offset, whence): if whence == 0: self.posn = offset elif whence == 1: self.posn += offset else: raise IOError, "Unrecognized whence value %d" % whence class HasTell(RootFile): def __init__(self): super(HasTell, self).__init__() def tell(self): return self.posn class HasRead(RootFile): def __init__(self): super(HasRead, self).__init__() def read(self, n): raise IOError, "Not implemented" class NoTell(HasSeek, HasRead): pass self.NoTell = NoTell class NoSeek(HasTell, HasRead): pass self.NoSeek = NoSeek class NoRead(HasSeek, HasTell): pass self.NoRead = NoRead class RaiseMyException(HasSeek, HasTell): def read(self, n): raise MyException, exception_value self.RaiseMyException = RaiseMyException class RaiseMemoryError(HasSeek, HasTell): def read(self, n): raise MemoryError, exception_value self.RaiseMemoryError = RaiseMemoryError class DummyFreeImage(object): def LoadFromHandle(self, type, io_p, handle, flags): io = io_p._obj io.tell_proc(None) io.seek_proc(None, 0, 0) io.read_proc(None, 0, 0, None) return 0 self.dummy_freeimage = DummyFreeImage()