예제 #1
0
 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
예제 #2
0
파일: library.py 프로젝트: UIKit0/upscaledb
 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
예제 #3
0
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