def test_base256_padding(self): result = Helper.base256_encode(1230, minwidth=5) self.assertEqual(5, len(result))
def test_base256_zero_input(self): result = Helper.base256_encode(0) self.assertEqual(bytearray.fromhex('00'), result)
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))
def test_base256_encode(self): val = 1234567890 res = Helper.base256_encode(val) self.assertEqual(res, bytearray(b'\xd2\x02\x96I'))