Ejemplo n.º 1
0
 def save(self, filename):
     if self.config['t'] == 'string':
         fastdict.save_compress_uint32_string(filename, self.storage)
     elif self.config['t'] == 'int8':
         fastdict.save_compress_uint32_int8(filename, self.storage)
     elif self.config['t'] == 'int32':
         fastdict.save_compress_uint32_int(filename, self.storage)
Ejemplo n.º 2
0
 def save(self, filename):
     if self.config['t'] == 'string':
         fastdict.save_compress_uint32_string(filename, self.storage)
     elif self.config['t'] == 'int8':
         fastdict.save_compress_uint32_int8(filename, self.storage)
     elif self.config['t'] == 'int32':
         fastdict.save_compress_uint32_int(filename, self.storage)
Ejemplo n.º 3
0
    def test_saveandload(self):
        f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)    
        f_dict.set(123, 78912893, "0")
        f_dict.set(456, 789, "1")

        fastdict.save_compress_uint32_string("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        fastdict.load_compress_uint32_string("test.dict", another_f_dict)

        self.assertEqual(another_f_dict.size(), 2)
Ejemplo n.º 4
0
    def test_saveandload(self):
        f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        f_dict.set(123, 78912893, "0")
        f_dict.set(456, 789, "1")

        fastdict.save_compress_uint32_string("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        fastdict.load_compress_uint32_string("test.dict", another_f_dict)

        self.assertEqual(another_f_dict.size(), 2)
Ejemplo n.º 5
0
    def test_keydimensions(self):
        f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        f_dict.set_keydimensions([1, 2, 3])

        keydimensions = []
        f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])

        fastdict.save_compress_uint32_string("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        fastdict.load_compress_uint32_string("test.dict", another_f_dict)

        keydimensions = []
        another_f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])
Ejemplo n.º 6
0
    def test_keydimensions(self):
        f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        f_dict.set_keydimensions([1, 2, 3])

        keydimensions = []
        f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])

        fastdict.save_compress_uint32_string("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32StringDict(self.dimension)
        fastdict.load_compress_uint32_string("test.dict", another_f_dict)

        keydimensions = []
        another_f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])