Thread: [pywin32-checkins] pywin32/com/win32com/test errorSemantics.py, 1.6, 1.7
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-11-26 01:21:54
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13682 Modified Files: errorSemantics.py Log Message: Syntax modernizations to make it py3k friendly. Index: errorSemantics.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/errorSemantics.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** errorSemantics.py 7 Sep 2004 02:10:49 -0000 1.6 --- errorSemantics.py 26 Nov 2008 01:21:47 -0000 1.7 *************** *** 32,36 **** def Commit(self, flags): ! raise "foo" def test(): --- 32,36 ---- def Commit(self, flags): ! raise Exception("foo") def test(): *************** *** 39,46 **** try: com_server.Clone() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.E_UNEXPECTED: raise error("Calling the object natively did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 39,47 ---- try: com_server.Clone() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.E_UNEXPECTED: raise error("Calling the object natively did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) *************** *** 54,62 **** finally: cap.release() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.E_FAIL: raise error("The hresult was not E_FAIL for an internal error", com_exc) ! if exc[1] != "Python COM Server Internal Error": raise error("The description in the exception tuple did not yield the correct string", com_exc) # Check we saw a traceback in stderr --- 55,63 ---- finally: cap.release() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.E_FAIL: raise error("The hresult was not E_FAIL for an internal error", com_exc) ! if com_exc.excepinfo[1] != "Python COM Server Internal Error": raise error("The description in the exception tuple did not yield the correct string", com_exc) # Check we saw a traceback in stderr *************** *** 68,75 **** try: com_server.Clone() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 69,77 ---- try: com_server.Clone() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) *************** *** 84,91 **** finally: cap.release() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_FAIL: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 86,94 ---- finally: cap.release() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_FAIL: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) |