示例#1
0
 def test_byte_string_60(self):
     val = 0x111111111111111
     byte_string = short_id._to_byte_string(val, 60)
     self.assertEqual('\x11\x11\x11\x11\x11\x11\x11\x10', byte_string)
示例#2
0
 def test_byte_string_16(self):
     self.assertEqual('\xab\xcd', short_id._to_byte_string(0xabcd, 16))
     self.assertEqual('\x0a\xbc', short_id._to_byte_string(0xabc, 16))
示例#3
0
 def test_byte_string_12(self):
     self.assertEqual('\xab\xc0', short_id._to_byte_string(0xabc, 12))
     self.assertEqual('\x0a\xb0', short_id._to_byte_string(0x0ab, 12))
示例#4
0
 def test_byte_string_8(self):
     self.assertEqual('\xab', short_id._to_byte_string(0xab, 8))
     self.assertEqual('\x05', short_id._to_byte_string(0x05, 8))
示例#5
0
 def test_byte_string_60(self):
     val = 0x111111111111111
     byte_string = short_id._to_byte_string(val, 60)
     self.assertEqual('\x11\x11\x11\x11\x11\x11\x11\x10', byte_string)
示例#6
0
 def test_byte_string_12(self):
     self.assertEqual('\xab\xc0', short_id._to_byte_string(0xabc, 12))
     self.assertEqual('\x0a\xb0', short_id._to_byte_string(0x0ab, 12))
示例#7
0
 def test_byte_string_16(self):
     self.assertEqual('\xab\xcd', short_id._to_byte_string(0xabcd, 16))
     self.assertEqual('\x0a\xbc', short_id._to_byte_string(0xabc, 16))
示例#8
0
 def test_byte_string_8(self):
     self.assertEqual('\xab', short_id._to_byte_string(0xab, 8))
     self.assertEqual('\x05', short_id._to_byte_string(0x05, 8))