# Path: xpaw/config.py
# class Config(MutableMapping):
#     def __init__(self, __values=None, **kwargs):
#         self.attrs = {}
#         self.update(__values, **kwargs)
# 
#     def __getitem__(self, name):
#         if name not in self:
#             return None
#         return self.attrs[name]
# 
#     def __contains__(self, name):
#         return name in self.attrs
# 
#     def get(self, name, default=None):
#         return self[name] if self[name] is not None else default
# 
#     def getbool(self, name, default=None):
#         v = self.get(name, default)
#         return getbool(v)
# 
#     def getint(self, name, default=None):
#         v = self.get(name, default)
#         return getint(v)
# 
#     def getfloat(self, name, default=None):
#         v = self.get(name, default)
#         return getfloat(v)
# 
#     def getlist(self, name, default=None):
#         v = self.get(name, default)
#         return getlist(v)
# 
#     def __setitem__(self, name, value):
#         self.attrs[name] = value
# 
#     def set(self, name, value):
#         self[name] = value
# 
#     def setdefault(self, k, default=None):
#         if k not in self:
#             self[k] = default
# 
#     def update(self, __values=None, **kwargs):
#         if __values is not None:
#             if isinstance(__values, Config):
#                 for name in __values:
#                     self[name] = __values[name]
#             else:
#                 for name, value in __values.items():
#                     self[name] = value
#         for k, v in kwargs.items():
#             self[k] = v
# 
#     def delete(self, name):
#         del self.attrs[name]
# 
#     def __delitem__(self, name):
#         del self.attrs[name]
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def __iter__(self):
#         return iter(self.attrs)
# 
#     def __len__(self):
#         return len(self.attrs)


from xpaw.config import Config
        assert config.getfloat('float_str_1.1') == 1.1
        assert config.getfloat('float_none') is None
        assert config.getfloat('float_no') is None
        assert config.getfloat('float_1.1', 0) == 1.1
        assert config.getfloat('float_none', 0) is None
        assert config.getfloat('float_no', 0) == 0

    def test_get_list(self):
        d = {'list': [1, 2], 'tuple': (1, 2), 'single': 1, 'list_str': '1,2'}
        config = Config(d)
        assert config.getlist('list') == [1, 2]
        assert config.getlist('tuple') == [1, 2]
        assert config.getlist('single') == [1]
        assert config.getlist('list_str') == ['1', '2']
        assert config.getlist('list', [1]) == [1, 2]
        assert config.getlist('no_such_list') is None
        assert config.getlist('no_such_list', [1]) == [1]

    def test_set(self):
        config = Config()
        config.set('key', 'value')
        assert len(config) == 1 and config['key'] == 'value'

        config.set('key', 'value2')
        assert config['key'] == 'value2'

        config.set('key2', 'value')
        assert len(config) == 2 and config['key2'] == 'value'

    def test_set_item(self):

# Path: xpaw/config.py
# class Config(MutableMapping):
#     def __init__(self, __values=None, **kwargs):
#         self.attrs = {}
#         self.update(__values, **kwargs)
# 
#     def __getitem__(self, name):
#         if name not in self:
#             return None
#         return self.attrs[name]
# 
#     def __contains__(self, name):
#         return name in self.attrs
# 
#     def get(self, name, default=None):
#         return self[name] if self[name] is not None else default
# 
#     def getbool(self, name, default=None):
#         v = self.get(name, default)
#         return getbool(v)
# 
#     def getint(self, name, default=None):
#         v = self.get(name, default)
#         return getint(v)
# 
#     def getfloat(self, name, default=None):
#         v = self.get(name, default)
#         return getfloat(v)
# 
#     def getlist(self, name, default=None):
#         v = self.get(name, default)
#         return getlist(v)
# 
#     def __setitem__(self, name, value):
#         self.attrs[name] = value
# 
#     def set(self, name, value):
#         self[name] = value
# 
#     def setdefault(self, k, default=None):
#         if k not in self:
#             self[k] = default
# 
#     def update(self, __values=None, **kwargs):
#         if __values is not None:
#             if isinstance(__values, Config):
#                 for name in __values:
#                     self[name] = __values[name]
#             else:
#                 for name, value in __values.items():
#                     self[name] = value
#         for k, v in kwargs.items():
#             self[k] = v
# 
#     def delete(self, name):
#         del self.attrs[name]
# 
#     def __delitem__(self, name):
#         del self.attrs[name]
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def __iter__(self):
#         return iter(self.attrs)
# 
#     def __len__(self):
#         return len(self.attrs)


# Path: tests/test_config.py
from xpaw.config import Config

        assert config.getfloat('float_str_1.1') == 1.1
        assert config.getfloat('float_none') is None
        assert config.getfloat('float_no') is None
        assert config.getfloat('float_1.1', 0) == 1.1
        assert config.getfloat('float_none', 0) is None
        assert config.getfloat('float_no', 0) == 0

    def test_get_list(self):
        d = {'list': [1, 2], 'tuple': (1, 2), 'single': 1, 'list_str': '1,2'}
        config = Config(d)
        assert config.getlist('list') == [1, 2]
        assert config.getlist('tuple') == [1, 2]
        assert config.getlist('single') == [1]
        assert config.getlist('list_str') == ['1', '2']
        assert config.getlist('list', [1]) == [1, 2]
        assert config.getlist('no_such_list') is None
        assert config.getlist('no_such_list', [1]) == [1]

    def test_set(self):
        config = Config()
        config.set('key', 'value')
        assert len(config) == 1 and config['key'] == 'value'

        config.set('key', 'value2')
        assert config['key'] == 'value2'

        config.set('key2', 'value')
        assert len(config) == 2 and config['key2'] == 'value'

    def test_set_item(self):

        config = Config()