[lang-ref] ( parse_oct ) ( python )

def test_parse_oct():
    # int('755', 8)

    # specify base-8
    assert int('755'   , 8) == 493
    assert int('0755'  , 8) == 493
    assert int('0o755' , 8) == 493

    # auto detect
    assert int('0o755' , 0) == 493

    assert int('755'   , 0) == 755  # That’s true.

    with pytest.raises(ValueError):
        int('0755', 0)  # prefix is required