def test_round_trip(self): test_data = [ _pad_to(bin(struct.unpack('<I', os.urandom(4))[0]), 32) for _ in range(1000)] for value in test_data: round_tripped = hex_to_bin(bin_to_hex(value)) assert round_tripped == value
def test_round_trip(self): test_data = [ _pad_to(bin(struct.unpack('<I', os.urandom(4))[0]), 32) for _ in range(1000) ] for value in test_data: round_tripped = hex_to_bin(bin_to_hex(value)) assert round_tripped == value
def test_negative_zero(self): expected = '0x80000000' result = bin_to_hex('0b10000000000000000000000000000000') assert result == expected
def test_zero(self): expected = '0x00000000' result = bin_to_hex('0b00000000000000000000000000000000') assert result == expected