[lang-ref] ( parse_hex ) ( python )
def test_parse_hex():
# int('FF', 16)
# specify base-16
assert int('FF' , 16) == 255
assert int('ff' , 16) == 255
assert int('0xFF' , 16) == 255
# auto detect
assert int('0xFF' , 0) == 255
with pytest.raises(ValueError):
int('FF', 0) # prefix is required