[pywin32-checkins] pywin32/win32/test test_exceptions.py,1.2,1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-10-01 06:49:45
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31284/test Modified Files: test_exceptions.py Log Message: Add attributes to pywintypes.error and pywintypes.com_error. Index: test_exceptions.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_exceptions.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_exceptions.py 30 Sep 2008 06:04:33 -0000 1.2 --- test_exceptions.py 1 Oct 2008 06:49:31 -0000 1.3 *************** *** 65,68 **** --- 65,82 ---- self.failUnlessEqual(exc.__class__.__name__, "error") + def testIdentity(self): + exc = self._getInvalidHandleException() + self.failUnless(exc.__class__ is pywintypes.error) + + def testBaseClass(self): + self.failUnlessEqual(pywintypes.error.__bases__, (Exception,)) + + def testAttributes(self): + exc = self._getInvalidHandleException() + err_msg = win32api.FormatMessage(winerror.ERROR_INVALID_HANDLE).rstrip() + self.failUnlessEqual(exc.winerror, winerror.ERROR_INVALID_HANDLE) + self.failUnlessEqual(exc.strerror, err_msg) + self.failUnlessEqual(exc.funcname, 'CloseHandle') + class TestCOMSimple(TestBase): def _getException(self): *************** *** 106,109 **** --- 120,139 ---- self.failUnlessEqual(exc.__class__.__name__, "com_error") + def testIdentity(self): + exc = self._getException() + self.failUnless(exc.__class__ is pywintypes.com_error) + + def testBaseClass(self): + exc = self._getException() + self.failUnlessEqual(pywintypes.com_error.__bases__, (Exception,)) + + def testAttributes(self): + exc = self._getException() + err_msg = win32api.FormatMessage(winerror.STG_E_INVALIDFLAG).rstrip() + self.failUnlessEqual(exc.hresult, winerror.STG_E_INVALIDFLAG) + self.failUnlessEqual(exc.strerror, err_msg) + self.failUnlessEqual(exc.argerror, None) + self.failUnlessEqual(exc.excepinfo, None) + if __name__ == '__main__': unittest.main() |