def test_cache(self): t = ToTable(self.path + ".tune", 'w', rcnum=8192) t['asdf'] = {'d': '2'} self.assertEquals(len(t) > 0, True) self.assertEquals(t['asdf'], {'d': '2'}) t.close() t = ToTable(self.path + ".tune", 'w', lcnum=1024, ncnum=200) self.assertEquals(t['asdf'], {'d': '2'}) t.close()
def test_optimize(self): from totable import TDBTLARGE, TDBTDEFLATE, TDBTBZIP, TDBTTCBS t = ToTable(self.path + ".tune", 'w') t.optimize() t.optimize(bnum=28, apow=3, fpow=2) # more realistic number is > 200K. t.optimize(bnum=208000) t.optimize(opts=TDBTBZIP) t.optimize(opts=TDBTDEFLATE) t.optimize(opts=TDBTTCBS) t.close()
def test_mmap_size(self): t = ToTable(self.path + ".tune", 'w', mmap_size=256 * 1e6) t['asdf'] = {'d': '2'} self.assertEquals(t['asdf'], {'d': '2'}) del t['asdf'] t.close()
def test_tune(self): from totable import TDBTTCBS t = ToTable(self.path + ".tune", 'w', bnum=1234, fpow=6, opts=TDBTTCBS) t['asdf'] = {'d': '1'} t.close()