Exemple #1
0
 def test_encode_value(self):
     expect = ('(\x02\x00\x00\x00s\x06\x00\x00\x00doubani\x00\x00\x00\x00',
               32)
     # FIXME
     vi = sys.version_info
     if vi.major == 2 and vi.micro == 7 and vi.minor < 9:
         assert encode_value(('douban', 0), 0) == expect
Exemple #2
0
 def test_encode_value(self):
     expect = ('(\x02\x00\x00\x00s\x06\x00\x00\x00doubani\x00\x00\x00\x00',
               32)
     # FIXME
     vi = sys.version_info
     if vi.major == 2 and vi.micro == 7 and vi.minor < 9:
         assert encode_value(('douban', 0), 0) == expect
Exemple #3
0
 def test_decode_value(self):
     dataset = [
         True,
         0,
         100,
         1000L,
         10.24,
         DiveMaster(1024),
         "scubadiving",
     ]
     for d in dataset:
         new_d = decode_value(*encode_value(d, 0))
         assert new_d == d
         if isinstance(d, DiveMaster):
           assert d is not new_d
Exemple #4
0
 def test_decode_value(self):
     dataset = [
         True,
         0,
         100,
         1000L,
         10.24,
         DiveMaster(1024),
         "scubadiving",
     ]
     for d in dataset:
         new_d = decode_value(*encode_value(d, 0))
         assert new_d == d
         if isinstance(d, DiveMaster):
             assert d is not new_d
Exemple #5
0
 def prepare(self, data):
     return libmc.encode_value(data, self.mc.comp_threshold)