# Path: caput/config.py
# class Property:
# class Reader:
# class _line_dict(dict):
# class SafeLineLoader(SafeLoader):
# class CaputConfigError(Exception):
#     def __init__(self, default=None, proptype=None, key=None):
#     def __get__(self, obj, objtype):
#     def __set__(self, obj, val):
#     def _from_config(self, obj, config):
#     def _set_propname(self, obj):
#     def from_config(cls, config, *args, **kwargs):
#     def read_config(self, config, compare_keys=False, use_defaults=True):
#     def _finalise_config(self):
# def utc_time(default=None):
#     def _prop(val):
# def float_in_range(start, end, default=None):
#     def _prop(val):
# def enum(options, default=None):
#     def _prop(val):
# def list_type(type_=None, length=None, maxlength=None, default=None):
#     def _prop(val):
# def logging_config(default=None):
#     def _prop(config):
#     def construct_mapping(self, node, deep=False):
#     def __init__(self, message, file_=None, location=None):
#     def __str__(self):


import pickle
import pytest
import yaml
from caput import config
    person = PersonWithPet()
    person.read_config(testdict)

    assert person.name == "Richard"
    assert person.age == 40.0
    assert person.petname == "Sooty"


def test_pickle():

    person = PersonWithPet()
    person.read_config(testdict)
    person2 = pickle.loads(pickle.dumps(person))

    assert person2.name == "Richard"
    assert person2.age == 40.0
    assert person2.petname == "Sooty"


def test_list_type():

    lt = ListTypeTests()

    with pytest.raises(config.CaputConfigError):
        lt.read_config({"list_max_length": [1, 3, 4]})

    # Should work fine
    lt = ListTypeTests()
    lt.read_config({"list_max_length": [1, 2]})


# Path: caput/config.py
# class Property:
# class Reader:
# class _line_dict(dict):
# class SafeLineLoader(SafeLoader):
# class CaputConfigError(Exception):
#     def __init__(self, default=None, proptype=None, key=None):
#     def __get__(self, obj, objtype):
#     def __set__(self, obj, val):
#     def _from_config(self, obj, config):
#     def _set_propname(self, obj):
#     def from_config(cls, config, *args, **kwargs):
#     def read_config(self, config, compare_keys=False, use_defaults=True):
#     def _finalise_config(self):
# def utc_time(default=None):
#     def _prop(val):
# def float_in_range(start, end, default=None):
#     def _prop(val):
# def enum(options, default=None):
#     def _prop(val):
# def list_type(type_=None, length=None, maxlength=None, default=None):
#     def _prop(val):
# def logging_config(default=None):
#     def _prop(config):
#     def construct_mapping(self, node, deep=False):
#     def __init__(self, message, file_=None, location=None):
#     def __str__(self):


# Path: caput/tests/test_config.py
import pickle
import pytest
import yaml
from caput import config

    person = PersonWithPet()
    person.read_config(testdict)

    assert person.name == "Richard"
    assert person.age == 40.0
    assert person.petname == "Sooty"


def test_pickle():

    person = PersonWithPet()
    person.read_config(testdict)
    person2 = pickle.loads(pickle.dumps(person))

    assert person2.name == "Richard"
    assert person2.age == 40.0
    assert person2.petname == "Sooty"


def test_list_type():

    lt = ListTypeTests()

    with pytest.raises(config.CaputConfigError):
        lt.read_config({"list_max_length": [1, 3, 4]})

    # Should work fine
    lt = ListTypeTests()
    lt.read_config({"list_max_length": [1, 2]})


    with pytest.raises(config.CaputConfigError):