Пример #1
0
 def test_base256_padding(self):
     result = Helper.base256_encode(1230, minwidth=5)
     self.assertEqual(5, len(result))
Пример #2
0
 def test_base256_zero_input(self):
     result = Helper.base256_encode(0)
     self.assertEqual(bytearray.fromhex('00'), result)
Пример #3
0
 def test_base256_negative_input(self):
     with self.assertRaises(ValueError) as context:
         Helper.base256_encode(-1)
     self.assertTrue(
         "Negative numbers not supported" in str(context.exception))
Пример #4
0
 def test_base256_encode(self):
     val = 1234567890
     res = Helper.base256_encode(val)
     self.assertEqual(res, bytearray(b'\xd2\x02\x96I'))