def testSetErrhandler(self): global error_count upscaledb.set_error_handler(my_error_handler) error_count = 0 try: upscaledb.env().open("asxxxldjf") except upscaledb.error, (errno, strerror): assert upscaledb.UPS_FILE_NOT_FOUND == errno
class LibraryTestCase(unittest.TestCase): def testGetVersion(self): print "version: ", upscaledb.get_version() def testIsDebug(self): print "is_debug: ", upscaledb.is_debug() def testSetErrhandler(self): global error_count upscaledb.set_error_handler(my_error_handler) error_count = 0 try: upscaledb.env().open("asxxxldjf") except upscaledb.error, (errno, strerror): assert upscaledb.UPS_FILE_NOT_FOUND == errno assert error_count == 1 upscaledb.set_error_handler(None) error_count = 0 try: upscaledb.env().open("asxxxldjf") except upscaledb.error, (errno, strerror): assert upscaledb.UPS_FILE_NOT_FOUND == errno