Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.216.198
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib64 /
python2.7 /
bsddb /
test /
Delete
Unzip
Name
Size
Permission
Date
Action
__init__.py
0
B
-rw-r--r--
2024-04-10 08:28
__init__.pyc
130
B
-rw-r--r--
2024-04-10 08:28
__init__.pyo
130
B
-rw-r--r--
2024-04-10 08:28
test_all.py
18.7
KB
-rw-r--r--
2024-04-10 08:28
test_all.pyc
23.95
KB
-rw-r--r--
2024-04-10 08:28
test_all.pyo
23.95
KB
-rw-r--r--
2024-04-10 08:28
test_associate.py
15.32
KB
-rw-r--r--
2024-04-10 08:28
test_associate.pyc
20.14
KB
-rw-r--r--
2024-04-10 08:28
test_associate.pyo
20.14
KB
-rw-r--r--
2024-04-10 08:28
test_basics.py
35.4
KB
-rw-r--r--
2024-04-10 08:28
test_basics.pyc
33.32
KB
-rw-r--r--
2024-04-10 08:28
test_basics.pyo
33.32
KB
-rw-r--r--
2024-04-10 08:28
test_compare.py
14.79
KB
-rw-r--r--
2024-04-10 08:28
test_compare.pyc
19.28
KB
-rw-r--r--
2024-04-10 08:28
test_compare.pyo
19.28
KB
-rw-r--r--
2024-04-10 08:28
test_compat.py
4.43
KB
-rw-r--r--
2024-04-10 08:28
test_compat.pyc
5.3
KB
-rw-r--r--
2024-04-10 08:28
test_compat.pyo
5.3
KB
-rw-r--r--
2024-04-10 08:28
test_cursor_pget_bug.py
1.83
KB
-rw-r--r--
2024-04-10 08:28
test_cursor_pget_bug.pyc
2.6
KB
-rw-r--r--
2024-04-10 08:28
test_cursor_pget_bug.pyo
2.6
KB
-rw-r--r--
2024-04-10 08:28
test_db.py
5.66
KB
-rw-r--r--
2024-04-10 08:28
test_db.pyc
8.58
KB
-rw-r--r--
2024-04-10 08:28
test_db.pyo
8.58
KB
-rw-r--r--
2024-04-10 08:28
test_dbenv.py
18.78
KB
-rw-r--r--
2024-04-10 08:28
test_dbenv.pyc
21.78
KB
-rw-r--r--
2024-04-10 08:28
test_dbenv.pyo
21.78
KB
-rw-r--r--
2024-04-10 08:28
test_dbobj.py
2.35
KB
-rw-r--r--
2024-04-10 08:28
test_dbobj.pyc
3.35
KB
-rw-r--r--
2024-04-10 08:28
test_dbobj.pyo
3.35
KB
-rw-r--r--
2024-04-10 08:28
test_dbshelve.py
11.42
KB
-rw-r--r--
2024-04-10 08:28
test_dbshelve.pyc
13.95
KB
-rw-r--r--
2024-04-10 08:28
test_dbshelve.pyo
13.95
KB
-rw-r--r--
2024-04-10 08:28
test_dbtables.py
14.98
KB
-rw-r--r--
2024-04-10 08:28
test_dbtables.pyc
11.49
KB
-rw-r--r--
2024-04-10 08:28
test_dbtables.pyo
11.49
KB
-rw-r--r--
2024-04-10 08:28
test_distributed_transactions.py
4.76
KB
-rw-r--r--
2024-04-10 08:28
test_distributed_transactions.pyc
5.53
KB
-rw-r--r--
2024-04-10 08:28
test_distributed_transactions.pyo
5.53
KB
-rw-r--r--
2024-04-10 08:28
test_early_close.py
7.27
KB
-rw-r--r--
2024-04-10 08:28
test_early_close.pyc
6.66
KB
-rw-r--r--
2024-04-10 08:28
test_early_close.pyo
6.66
KB
-rw-r--r--
2024-04-10 08:28
test_fileid.py
1.79
KB
-rw-r--r--
2024-04-10 08:28
test_fileid.pyc
2.37
KB
-rw-r--r--
2024-04-10 08:28
test_fileid.pyo
2.37
KB
-rw-r--r--
2024-04-10 08:28
test_get_none.py
2.24
KB
-rw-r--r--
2024-04-10 08:28
test_get_none.pyc
2.82
KB
-rw-r--r--
2024-04-10 08:28
test_get_none.pyo
2.82
KB
-rw-r--r--
2024-04-10 08:28
test_join.py
3.09
KB
-rw-r--r--
2024-04-10 08:28
test_join.pyc
3.54
KB
-rw-r--r--
2024-04-10 08:28
test_join.pyo
3.54
KB
-rw-r--r--
2024-04-10 08:28
test_lock.py
6.44
KB
-rw-r--r--
2024-04-10 08:28
test_lock.pyc
5.94
KB
-rw-r--r--
2024-04-10 08:28
test_lock.pyo
5.94
KB
-rw-r--r--
2024-04-10 08:28
test_misc.py
4.68
KB
-rw-r--r--
2024-04-10 08:28
test_misc.pyc
5.01
KB
-rw-r--r--
2024-04-10 08:28
test_misc.pyo
5.01
KB
-rw-r--r--
2024-04-10 08:28
test_pickle.py
1.93
KB
-rw-r--r--
2024-04-10 08:28
test_pickle.pyc
2.75
KB
-rw-r--r--
2024-04-10 08:28
test_pickle.pyo
2.75
KB
-rw-r--r--
2024-04-10 08:28
test_queue.py
3.92
KB
-rw-r--r--
2024-04-10 08:28
test_queue.pyc
3.9
KB
-rw-r--r--
2024-04-10 08:28
test_queue.pyo
3.9
KB
-rw-r--r--
2024-04-10 08:28
test_recno.py
8.55
KB
-rw-r--r--
2024-04-10 08:28
test_recno.pyc
7.61
KB
-rw-r--r--
2024-04-10 08:28
test_recno.pyo
7.61
KB
-rw-r--r--
2024-04-10 08:28
test_replication.py
20.97
KB
-rw-r--r--
2024-04-10 08:28
test_replication.pyc
15.54
KB
-rw-r--r--
2024-04-10 08:28
test_replication.pyo
15.54
KB
-rw-r--r--
2024-04-10 08:28
test_sequence.py
5.15
KB
-rw-r--r--
2024-04-10 08:28
test_sequence.pyc
6.56
KB
-rw-r--r--
2024-04-10 08:28
test_sequence.pyo
6.56
KB
-rw-r--r--
2024-04-10 08:28
test_thread.py
15.54
KB
-rw-r--r--
2024-04-10 08:28
test_thread.pyc
14.97
KB
-rw-r--r--
2024-04-10 08:28
test_thread.pyo
14.97
KB
-rw-r--r--
2024-04-10 08:28
Save
Rename
""" TestCases for python DB duplicate and Btree key comparison function. """ import sys, os, re import test_all from cStringIO import StringIO import unittest from test_all import db, dbshelve, test_support, \ get_new_environment_path, get_new_database_path # Needed for python 3. "cmp" vanished in 3.0.1 def cmp(a, b) : if a==b : return 0 if a<b : return -1 return 1 lexical_cmp = cmp def lowercase_cmp(left, right) : return cmp(left.lower(), right.lower()) def make_reverse_comparator(cmp) : def reverse(left, right, delegate=cmp) : return - delegate(left, right) return reverse _expected_lexical_test_data = ['', 'CCCP', 'a', 'aaa', 'b', 'c', 'cccce', 'ccccf'] _expected_lowercase_test_data = ['', 'a', 'aaa', 'b', 'c', 'CC', 'cccce', 'ccccf', 'CCCP'] class ComparatorTests(unittest.TestCase) : def comparator_test_helper(self, comparator, expected_data) : data = expected_data[:] import sys if sys.version_info < (2, 6) : data.sort(cmp=comparator) else : # Insertion Sort. Please, improve data2 = [] for i in data : for j, k in enumerate(data2) : r = comparator(k, i) if r == 1 : data2.insert(j, i) break else : data2.append(i) data = data2 self.assertEqual(data, expected_data, "comparator `%s' is not right: %s vs. %s" % (comparator, expected_data, data)) def test_lexical_comparator(self) : self.comparator_test_helper(lexical_cmp, _expected_lexical_test_data) def test_reverse_lexical_comparator(self) : rev = _expected_lexical_test_data[:] rev.reverse() self.comparator_test_helper(make_reverse_comparator(lexical_cmp), rev) def test_lowercase_comparator(self) : self.comparator_test_helper(lowercase_cmp, _expected_lowercase_test_data) class AbstractBtreeKeyCompareTestCase(unittest.TestCase) : env = None db = None if (sys.version_info < (2, 7)) or ((sys.version_info >= (3,0)) and (sys.version_info < (3, 2))) : def assertLess(self, a, b, msg=None) : return self.assertTrue(a<b, msg=msg) def setUp(self) : self.filename = self.__class__.__name__ + '.db' self.homeDir = get_new_environment_path() env = db.DBEnv() env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_THREAD) self.env = env def tearDown(self) : self.closeDB() if self.env is not None: self.env.close() self.env = None test_support.rmtree(self.homeDir) def addDataToDB(self, data) : i = 0 for item in data: self.db.put(item, str(i)) i = i + 1 def createDB(self, key_comparator) : self.db = db.DB(self.env) self.setupDB(key_comparator) self.db.open(self.filename, "test", db.DB_BTREE, db.DB_CREATE) def setupDB(self, key_comparator) : self.db.set_bt_compare(key_comparator) def closeDB(self) : if self.db is not None: self.db.close() self.db = None def startTest(self) : pass def finishTest(self, expected = None) : if expected is not None: self.check_results(expected) self.closeDB() def check_results(self, expected) : curs = self.db.cursor() try: index = 0 rec = curs.first() while rec: key, ignore = rec self.assertLess(index, len(expected), "to many values returned from cursor") self.assertEqual(expected[index], key, "expected value `%s' at %d but got `%s'" % (expected[index], index, key)) index = index + 1 rec = curs.next() self.assertEqual(index, len(expected), "not enough values returned from cursor") finally: curs.close() class BtreeKeyCompareTestCase(AbstractBtreeKeyCompareTestCase) : def runCompareTest(self, comparator, data) : self.startTest() self.createDB(comparator) self.addDataToDB(data) self.finishTest(data) def test_lexical_ordering(self) : self.runCompareTest(lexical_cmp, _expected_lexical_test_data) def test_reverse_lexical_ordering(self) : expected_rev_data = _expected_lexical_test_data[:] expected_rev_data.reverse() self.runCompareTest(make_reverse_comparator(lexical_cmp), expected_rev_data) def test_compare_function_useless(self) : self.startTest() def socialist_comparator(l, r) : return 0 self.createDB(socialist_comparator) self.addDataToDB(['b', 'a', 'd']) # all things being equal the first key will be the only key # in the database... (with the last key's value fwiw) self.finishTest(['b']) class BtreeExceptionsTestCase(AbstractBtreeKeyCompareTestCase) : def test_raises_non_callable(self) : self.startTest() self.assertRaises(TypeError, self.createDB, 'abc') self.assertRaises(TypeError, self.createDB, None) self.finishTest() def test_set_bt_compare_with_function(self) : self.startTest() self.createDB(lexical_cmp) self.finishTest() def check_results(self, results) : pass def test_compare_function_incorrect(self) : self.startTest() def bad_comparator(l, r) : return 1 # verify that set_bt_compare checks that comparator('', '') == 0 self.assertRaises(TypeError, self.createDB, bad_comparator) self.finishTest() def verifyStderr(self, method, successRe) : """ Call method() while capturing sys.stderr output internally and call self.fail() if successRe.search() does not match the stderr output. This is used to test for uncatchable exceptions. """ stdErr = sys.stderr sys.stderr = StringIO() try: method() finally: temp = sys.stderr sys.stderr = stdErr errorOut = temp.getvalue() if not successRe.search(errorOut) : self.fail("unexpected stderr output:\n"+errorOut) if sys.version_info < (3, 0) : # XXX: How to do this in Py3k ??? sys.exc_traceback = sys.last_traceback = None def _test_compare_function_exception(self) : self.startTest() def bad_comparator(l, r) : if l == r: # pass the set_bt_compare test return 0 raise RuntimeError, "i'm a naughty comparison function" self.createDB(bad_comparator) #print "\n*** test should print 2 uncatchable tracebacks ***" self.addDataToDB(['a', 'b', 'c']) # this should raise, but... self.finishTest() def test_compare_function_exception(self) : self.verifyStderr( self._test_compare_function_exception, re.compile('(^RuntimeError:.* naughty.*){2}', re.M|re.S) ) def _test_compare_function_bad_return(self) : self.startTest() def bad_comparator(l, r) : if l == r: # pass the set_bt_compare test return 0 return l self.createDB(bad_comparator) #print "\n*** test should print 2 errors about returning an int ***" self.addDataToDB(['a', 'b', 'c']) # this should raise, but... self.finishTest() def test_compare_function_bad_return(self) : self.verifyStderr( self._test_compare_function_bad_return, re.compile('(^TypeError:.* return an int.*){2}', re.M|re.S) ) def test_cannot_assign_twice(self) : def my_compare(a, b) : return 0 self.startTest() self.createDB(my_compare) self.assertRaises(RuntimeError, self.db.set_bt_compare, my_compare) class AbstractDuplicateCompareTestCase(unittest.TestCase) : env = None db = None if (sys.version_info < (2, 7)) or ((sys.version_info >= (3,0)) and (sys.version_info < (3, 2))) : def assertLess(self, a, b, msg=None) : return self.assertTrue(a<b, msg=msg) def setUp(self) : self.filename = self.__class__.__name__ + '.db' self.homeDir = get_new_environment_path() env = db.DBEnv() env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_THREAD) self.env = env def tearDown(self) : self.closeDB() if self.env is not None: self.env.close() self.env = None test_support.rmtree(self.homeDir) def addDataToDB(self, data) : for item in data: self.db.put("key", item) def createDB(self, dup_comparator) : self.db = db.DB(self.env) self.setupDB(dup_comparator) self.db.open(self.filename, "test", db.DB_BTREE, db.DB_CREATE) def setupDB(self, dup_comparator) : self.db.set_flags(db.DB_DUPSORT) self.db.set_dup_compare(dup_comparator) def closeDB(self) : if self.db is not None: self.db.close() self.db = None def startTest(self) : pass def finishTest(self, expected = None) : if expected is not None: self.check_results(expected) self.closeDB() def check_results(self, expected) : curs = self.db.cursor() try: index = 0 rec = curs.first() while rec: ignore, data = rec self.assertLess(index, len(expected), "to many values returned from cursor") self.assertEqual(expected[index], data, "expected value `%s' at %d but got `%s'" % (expected[index], index, data)) index = index + 1 rec = curs.next() self.assertEqual(index, len(expected), "not enough values returned from cursor") finally: curs.close() class DuplicateCompareTestCase(AbstractDuplicateCompareTestCase) : def runCompareTest(self, comparator, data) : self.startTest() self.createDB(comparator) self.addDataToDB(data) self.finishTest(data) def test_lexical_ordering(self) : self.runCompareTest(lexical_cmp, _expected_lexical_test_data) def test_reverse_lexical_ordering(self) : expected_rev_data = _expected_lexical_test_data[:] expected_rev_data.reverse() self.runCompareTest(make_reverse_comparator(lexical_cmp), expected_rev_data) class DuplicateExceptionsTestCase(AbstractDuplicateCompareTestCase) : def test_raises_non_callable(self) : self.startTest() self.assertRaises(TypeError, self.createDB, 'abc') self.assertRaises(TypeError, self.createDB, None) self.finishTest() def test_set_dup_compare_with_function(self) : self.startTest() self.createDB(lexical_cmp) self.finishTest() def check_results(self, results) : pass def test_compare_function_incorrect(self) : self.startTest() def bad_comparator(l, r) : return 1 # verify that set_dup_compare checks that comparator('', '') == 0 self.assertRaises(TypeError, self.createDB, bad_comparator) self.finishTest() def test_compare_function_useless(self) : self.startTest() def socialist_comparator(l, r) : return 0 self.createDB(socialist_comparator) # DUPSORT does not allow "duplicate duplicates" self.assertRaises(db.DBKeyExistError, self.addDataToDB, ['b', 'a', 'd']) self.finishTest() def verifyStderr(self, method, successRe) : """ Call method() while capturing sys.stderr output internally and call self.fail() if successRe.search() does not match the stderr output. This is used to test for uncatchable exceptions. """ stdErr = sys.stderr sys.stderr = StringIO() try: method() finally: temp = sys.stderr sys.stderr = stdErr errorOut = temp.getvalue() if not successRe.search(errorOut) : self.fail("unexpected stderr output:\n"+errorOut) if sys.version_info < (3, 0) : # XXX: How to do this in Py3k ??? sys.exc_traceback = sys.last_traceback = None def _test_compare_function_exception(self) : self.startTest() def bad_comparator(l, r) : if l == r: # pass the set_dup_compare test return 0 raise RuntimeError, "i'm a naughty comparison function" self.createDB(bad_comparator) #print "\n*** test should print 2 uncatchable tracebacks ***" self.addDataToDB(['a', 'b', 'c']) # this should raise, but... self.finishTest() def test_compare_function_exception(self) : self.verifyStderr( self._test_compare_function_exception, re.compile('(^RuntimeError:.* naughty.*){2}', re.M|re.S) ) def _test_compare_function_bad_return(self) : self.startTest() def bad_comparator(l, r) : if l == r: # pass the set_dup_compare test return 0 return l self.createDB(bad_comparator) #print "\n*** test should print 2 errors about returning an int ***" self.addDataToDB(['a', 'b', 'c']) # this should raise, but... self.finishTest() def test_compare_function_bad_return(self) : self.verifyStderr( self._test_compare_function_bad_return, re.compile('(^TypeError:.* return an int.*){2}', re.M|re.S) ) def test_cannot_assign_twice(self) : def my_compare(a, b) : return 0 self.startTest() self.createDB(my_compare) self.assertRaises(RuntimeError, self.db.set_dup_compare, my_compare) def test_suite() : res = unittest.TestSuite() res.addTest(unittest.makeSuite(ComparatorTests)) res.addTest(unittest.makeSuite(BtreeExceptionsTestCase)) res.addTest(unittest.makeSuite(BtreeKeyCompareTestCase)) res.addTest(unittest.makeSuite(DuplicateExceptionsTestCase)) res.addTest(unittest.makeSuite(DuplicateCompareTestCase)) return res if __name__ == '__main__': unittest.main(defaultTest = 'suite')