예제 #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'))