# Path: project/configuration/utils.py
# def env_var(key, default=None):
#     """Retrieves env vars and makes Python boolean replacements"""
#     val = os.getenv(key, default)
#     if val == 'True':
#         val = True
#     elif val == 'False':
#         val = False
#     return val


import matplotlib
import os
import mock as mock
from project.configuration.utils import env_var

matplotlib.use('Agg')





def test_env_var_unset():
    assert env_var('UNSET_ENV_VAR') is None


@mock.patch.dict(os.environ, {'FALSE_ENV_VAR': 'False'})
def test_env_var_false():
    assert env_var('FALSE_ENV_VAR') is False


@mock.patch.dict(os.environ, {'TRUE_ENV_VAR': 'True'})
def test_env_var_true():
    assert env_var('TRUE_ENV_VAR') is True


@mock.patch.dict(os.environ, {'FOO': 'bar'})
def test_env_var_str():

# Path: project/configuration/utils.py
# def env_var(key, default=None):
#     """Retrieves env vars and makes Python boolean replacements"""
#     val = os.getenv(key, default)
#     if val == 'True':
#         val = True
#     elif val == 'False':
#         val = False
#     return val


# Path: tests/test_configuration_utils.py
import matplotlib
import os
import mock as mock
from project.configuration.utils import env_var


matplotlib.use('Agg')





def test_env_var_unset():
    assert env_var('UNSET_ENV_VAR') is None


@mock.patch.dict(os.environ, {'FALSE_ENV_VAR': 'False'})
def test_env_var_false():
    assert env_var('FALSE_ENV_VAR') is False


@mock.patch.dict(os.environ, {'TRUE_ENV_VAR': 'True'})
def test_env_var_true():
    assert env_var('TRUE_ENV_VAR') is True


@mock.patch.dict(os.environ, {'FOO': 'bar'})
def test_env_var_str():

    assert env_var('FOO') is 'bar'