[lang-ref] ( format_hex ) ( python )

def test_format_hex():
    # hex(n) / format(n, 'X')
    n = 0xFF
    assert hex(n)         == '0xff'
    assert format(n, 'x') == 'ff'
    assert format(n, 'X') == 'FF'
    assert '%02x' % n     == 'ff'
    assert '%02X' % n     == 'FF'