Exemplo n.º 1
0
 def test_byte_string_12(self):
     self.assertEqual(short_id._to_byte_string(0xabc, 12), '\xab\xc0')
     self.assertEqual(short_id._to_byte_string(0x0ab, 12), '\x0a\xb0')
Exemplo n.º 2
0
 def test_byte_string_60(self):
     val = 0x111111111111111
     byte_string = short_id._to_byte_string(val, 60)
     self.assertEqual(byte_string, '\x11\x11\x11\x11\x11\x11\x11\x10')
Exemplo n.º 3
0
 def test_byte_string_8(self):
     self.assertEqual(short_id._to_byte_string(0xab, 8), '\xab')
     self.assertEqual(short_id._to_byte_string(0x05, 8), '\x05')
Exemplo n.º 4
0
 def test_byte_string_16(self):
     self.assertEqual(short_id._to_byte_string(0xabcd, 16), '\xab\xcd')
     self.assertEqual(short_id._to_byte_string(0xabc, 16), '\x0a\xbc')
Exemplo n.º 5
0
 def test_byte_string_12(self):
     self.assertEqual(b'\xab\xc0', short_id._to_byte_string(0xabc, 12))
     self.assertEqual(b'\x0a\xb0', short_id._to_byte_string(0x0ab, 12))
Exemplo n.º 6
0
 def test_byte_string_60(self):
     val = 0x111111111111111
     byte_string = short_id._to_byte_string(val, 60)
     self.assertEqual(b'\x11\x11\x11\x11\x11\x11\x11\x10', byte_string)
Exemplo n.º 7
0
 def test_byte_string_16(self):
     self.assertEqual(b'\xab\xcd', short_id._to_byte_string(0xabcd, 16))
     self.assertEqual(b'\x0a\xbc', short_id._to_byte_string(0xabc, 16))
Exemplo n.º 8
0
 def test_byte_string_8(self):
     self.assertEqual(b'\xab', short_id._to_byte_string(0xab, 8))
     self.assertEqual(b'\x05', short_id._to_byte_string(0x05, 8))
Exemplo n.º 9
0
 def test_byte_string_12(self):
     self.assertEqual(u"\xab\xc0", short_id._to_byte_string(0xABC, 12))
     self.assertEqual(u"\x0a\xb0", short_id._to_byte_string(0x0AB, 12))
Exemplo n.º 10
0
 def test_byte_string_16(self):
     self.assertEqual(u"\xab\xcd", short_id._to_byte_string(0xABCD, 16))
     self.assertEqual(u"\x0a\xbc", short_id._to_byte_string(0xABC, 16))
Exemplo n.º 11
0
 def test_byte_string_8(self):
     self.assertEqual(u"\xab", short_id._to_byte_string(0xAB, 8))
     self.assertEqual(u"\x05", short_id._to_byte_string(0x05, 8))