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