def test_negation(): assert BinaryUtils.neg('1' * 32) == '0' * 32 assert BinaryUtils.neg('0' * 32) == '1' * 32
def _from_binary(cls, value): if value[0] == '0': return int(value, 2) neg = int(BinaryUtils.neg(value), 2) return -(neg + 1)