

def test_pex_bool_variables():
    (Variables(environ={
        
    })._get_bool('NOT_HERE', default=False) is False)
    (Variables(environ={
        
    })._get_bool('NOT_HERE', default=True) is True)
    for value in ('0', 'faLsE', 'false'):
        for default in (True, False):
            (Variables(environ={
                'HERE': value,
            })._get_bool('HERE', default=default) is False)
    for value in ('1', 'TrUe', 'true'):
        for default in (True, False):
            (Variables(environ={
                'HERE': value,
            })._get_bool('HERE', default=default) is True)
    with pytest.raises(SystemExit):
        Variables(environ={
            'HERE': 'garbage',
        })._get_bool('HERE')
    assert (Variables().PEX_ALWAYS_CACHE is False)
    assert (Variables({
        'PEX_ALWAYS_CACHE': '1',
    }).PEX_ALWAYS_CACHE is True)

dataset/ETHPy150Open pantsbuild/pex/tests/test_variables.py test_pex_bool_variables/original