Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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))
Exemple #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)
Exemple #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))
Exemple #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))
 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))
 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))
 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))