# Path: sydpy/component.py
# class Component:
# class System(Component):
#     def __init__(self, name=None, parent=None, **kwargs):
#     def __repr__(self):
#     def __setitem__(self, key, val):
#     def __getitem__(self, key):
#     def inst(self, name, cls, *args, **kwargs):
#     def search(self, pattern='*', of_type=None, depth=0, pattern_relative=True):
#     def __init__(self, name=''):
#     def __getattr__(self, name):
#     def _create_index_rec(self, comp):
#     def update_index(self):
#     def set_config(self, config):
#     def get_config(self, comp_qualified_name, attr_name):
#     def get_all_attrs(self, comp_qualified_name):
#     def update_params(self, comp_qualified_name, params):
# def sydsys(sid = 0):
# def restart_sydsys(sid = 0):
# def all2kwargs(func, *args, **kwargs):
# def compinit(func):
#     def wrapper(self, name=None, parent=None, *args, **kwargs):


from sydpy.component import Component, all2kwargs, system, compinit
    assert kwargs==dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8)

def test_update_params():
    conf = [('obj1.obj2.obj3.a', 4),
            ('obj1.*3.b', 4),
            ('obj1.*.obj?.c', 4),
            ('obj1.?3.c', 8),            
            ('*.*.*.d', 4),
            ('o*o*o*e', 4),
            ('*.*.*7.e', 8),
            ('obj?.obj?.obj?.f', 4),
            ('*.g', 4),
            ('*h', 4),
            ]
    
    system.set_config(conf)
    params = dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8)
    system.update_params('obj1.obj2.obj3', params)
    
    for _,v in params.items():
        assert v==4
        
def test_component_decorator():
    conf = [('obj1.obj2.obj3.a', 4),
            ('obj1.*.obj?.c', 4),
            ('*.*.*.d', 4),
            ('obj?.obj?.obj?.f', 4),
            ('*h', 4),
            ]
    

# Path: sydpy/component.py
# class Component:
# class System(Component):
#     def __init__(self, name=None, parent=None, **kwargs):
#     def __repr__(self):
#     def __setitem__(self, key, val):
#     def __getitem__(self, key):
#     def inst(self, name, cls, *args, **kwargs):
#     def search(self, pattern='*', of_type=None, depth=0, pattern_relative=True):
#     def __init__(self, name=''):
#     def __getattr__(self, name):
#     def _create_index_rec(self, comp):
#     def update_index(self):
#     def set_config(self, config):
#     def get_config(self, comp_qualified_name, attr_name):
#     def get_all_attrs(self, comp_qualified_name):
#     def update_params(self, comp_qualified_name, params):
# def sydsys(sid = 0):
# def restart_sydsys(sid = 0):
# def all2kwargs(func, *args, **kwargs):
# def compinit(func):
#     def wrapper(self, name=None, parent=None, *args, **kwargs):


# Path: tests/test_component.py
from sydpy.component import Component, all2kwargs, system, compinit

    assert kwargs==dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8)

def test_update_params():
    conf = [('obj1.obj2.obj3.a', 4),
            ('obj1.*3.b', 4),
            ('obj1.*.obj?.c', 4),
            ('obj1.?3.c', 8),            
            ('*.*.*.d', 4),
            ('o*o*o*e', 4),
            ('*.*.*7.e', 8),
            ('obj?.obj?.obj?.f', 4),
            ('*.g', 4),
            ('*h', 4),
            ]
    
    system.set_config(conf)
    params = dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8)
    system.update_params('obj1.obj2.obj3', params)
    
    for _,v in params.items():
        assert v==4
        
def test_component_decorator():
    conf = [('obj1.obj2.obj3.a', 4),
            ('obj1.*.obj?.c', 4),
            ('*.*.*.d', 4),
            ('obj?.obj?.obj?.f', 4),
            ('*h', 4),
            ]
    

    system.set_config(conf)