# Path: lcopt/data_store.py
# class LcoptStorage():
#     def __init__(self):
#     def load_config(self):
#     def refresh(self):
#     def write_default_config(self):
#     def write_config(self, config):
#     def models(self):
#     def search_indices(self):
#     def project_type(self):
#     def single_project_name(self):
#     def ecoinvent_version(self):
#     def ecoinvent_system_model(self):
#     def save_option(self):
# 
# Path: lcopt/settings.py
# ALLOWED_TYPES = [str, bool, int, float]
# class SettingsDict(object):
# class LcoptSettings(object):
#     def __init__(self, contents, write_function, **kwargs):
#     def __repr__(self):
#     def __setattr__(self, name, value):
#     def delete(self, attr):
#     def as_dict(self):
#     def __init__(self, **kwargs):
#     def as_dict(self):
#     def __repr__(self):
#     def refresh(self, **kwargs):
#     def write(self):
#     def launch_interact(self):


import pytest
from lcopt.data_store import storage
from lcopt.settings import settings
def test_change_existing_string():
	expected = '3.3'
	settings.ecoinvent.version = '3.3'
	assert settings.ecoinvent.version == expected
	assert storage.config['ecoinvent']['version'] == expected

def test_change_existing_float():
	expected = '3.3'
	settings.ecoinvent.version = 3.3
	assert settings.as_dict()['ecoinvent']['version'] == expected
	assert storage.config['ecoinvent']['version'] == expected

def test_add_and_delete_new():
	expected = 'bar'
	settings.model_storage.foo = 'bar'
	assert settings.model_storage.foo == expected
	assert storage.config['model_storage']['foo'] == expected	

	settings.model_storage.delete('foo')

	assert settings.as_dict()['model_storage'].get('foo') is None
	assert  storage.config['model_storage'].get('foo') is None

def test_delete_nonexistant():
	with pytest.raises(AttributeError) as excinfo:
		settings.ecoinvent.delete('non_existent_attribute')
	assert 'does not exist' in str(excinfo.value)

def test_disallowed_type():
	def f():

# Path: lcopt/data_store.py
# class LcoptStorage():
#     def __init__(self):
#     def load_config(self):
#     def refresh(self):
#     def write_default_config(self):
#     def write_config(self, config):
#     def models(self):
#     def search_indices(self):
#     def project_type(self):
#     def single_project_name(self):
#     def ecoinvent_version(self):
#     def ecoinvent_system_model(self):
#     def save_option(self):
# 
# Path: lcopt/settings.py
# ALLOWED_TYPES = [str, bool, int, float]
# class SettingsDict(object):
# class LcoptSettings(object):
#     def __init__(self, contents, write_function, **kwargs):
#     def __repr__(self):
#     def __setattr__(self, name, value):
#     def delete(self, attr):
#     def as_dict(self):
#     def __init__(self, **kwargs):
#     def as_dict(self):
#     def __repr__(self):
#     def refresh(self, **kwargs):
#     def write(self):
#     def launch_interact(self):


# Path: tests/test_settings.py
import pytest
from lcopt.data_store import storage
from lcopt.settings import settings

def test_change_existing_string():
	expected = '3.3'
	settings.ecoinvent.version = '3.3'
	assert settings.ecoinvent.version == expected
	assert storage.config['ecoinvent']['version'] == expected

def test_change_existing_float():
	expected = '3.3'
	settings.ecoinvent.version = 3.3
	assert settings.as_dict()['ecoinvent']['version'] == expected
	assert storage.config['ecoinvent']['version'] == expected

def test_add_and_delete_new():
	expected = 'bar'
	settings.model_storage.foo = 'bar'
	assert settings.model_storage.foo == expected
	assert storage.config['model_storage']['foo'] == expected	

	settings.model_storage.delete('foo')

	assert settings.as_dict()['model_storage'].get('foo') is None
	assert  storage.config['model_storage'].get('foo') is None

def test_delete_nonexistant():
	with pytest.raises(AttributeError) as excinfo:
		settings.ecoinvent.delete('non_existent_attribute')
	assert 'does not exist' in str(excinfo.value)

def test_disallowed_type():
	def f():

		pass