Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
test_com_exceptions Namespace Reference

Classes

class  PythonFailingComponent

Functions

def _testit
def test

Function Documentation

def test_com_exceptions._testit (   expected_errno,
  func,
  args 
) [private]

Definition at line 78 of file test_com_exceptions.py.

00078 
00079 def _testit(expected_errno, func, *args):
00080     try:
00081         apply(func, args)
00082     except COMException, what:
00083         if what.errno != expected_errno:
00084             raise

Here is the caller graph for this function:

Definition at line 85 of file test_com_exceptions.py.

00085 
00086 def test():
00087     # For the benefit of the test suite, we print some reassuring messages.
00088     import sys
00089     sys.__stderr__.write("***** NOTE: Three tracebacks below this is normal\n")
00090     ob = WrapObject( PythonFailingComponent(), components.interfaces.nsIPythonTestInterfaceExtra)
00091     _testit(nsError.NS_ERROR_FAILURE, ob.do_boolean, 0, 0)
00092     _testit(nsError.NS_ERROR_NOT_IMPLEMENTED, ob.do_octet, 0, 0)
00093     _testit(nsError.NS_ERROR_FAILURE, ob.do_short, 0, 0)
00094     _testit(nsError.NS_ERROR_FAILURE, ob.do_unsigned_short, 0, 0)
00095     _testit(nsError.NS_ERROR_FAILURE, ob.do_long, 0, 0)
00096     _testit(nsError.NS_ERROR_NOT_IMPLEMENTED, ob.do_unsigned_long, 0, 0)
00097     _testit(nsError.NS_ERROR_NOT_IMPLEMENTED, ob.do_long_long, 0, 0)
00098     _testit(nsError.NS_ERROR_FAILURE, ob.do_unsigned_long_long, 0, 0)
00099     print "The xpcom exception tests passed"
00100     # For the benefit of the test suite, some more reassuring messages.
00101     sys.__stderr__.write("***** NOTE: Three tracebacks printed above this is normal\n")
00102     sys.__stderr__.write("*****       It is testing the Python XPCOM Exception semantics\n")
00103 
test()

Here is the call graph for this function: