示例#1
0
 def update_level(self, host, level=0):
     """ It only initializes the values, does not get values from database. """
     self.controlled = True if host or level else False
     if type(level) is str: level = level.strip()
     if self.controlled:
         self.host, self.level = host.split('.')[0].strip(), trial(
             int, args=level, excepts=0)
     else:
         self.host, self.level = '', 0
示例#2
0
    assert None is fun.first([],None)
    assert 1 is fun.first((i for i in range(1,3)))
    assert 2 is fun.last((i for i in range(1,3)))
    assert 0 is fun.last([],default=0)
    print m+': OK'
except Skip:pass
except Exception,e: 
    traceback.print_exc()
    print m+': KO!'
    sys.exit(1)
    
try:
    m = 'fandango.excepts'
    if not fun.searchCl(a,m): raise Skip()
    import fandango.excepts as f_excepts
    assert 1 == f_excepts.trial(lambda:1/1,lambda e:10,return_exception=True)
    assert 10 == f_excepts.trial(lambda:1/0,lambda e:10,return_exception=True)
    print m+': OK'
except Skip:pass
except Exception,e: 
    traceback.print_exc()
    print m+': KO!'
    sys.exit(1)
    
try:
    m = 'fandango.tango'
    if not fun.searchCl(a,m): raise Skip()
    import fandango.tango as f_tango
    assert isinstance(f_tango.get_proxy('sys/database/2'),fandango.tango.PyTango.DeviceProxy)
    assert isinstance(f_tango.get_proxy('sys/database/2/state'),fandango.tango.PyTango.AttributeProxy)
    assert isinstance(f_tango.TGet(),fandango.tango.PyTango.Database)
示例#3
0
 def update_level(self,host,level=0):
     """ It only initializes the values, does not get values from database. """
     self.controlled = True if host or level else False
     if type(level) is str: level=level.strip()
     if self.controlled: self.host,self.level = host.split('.')[0].strip(),trial(int,args=level,excepts=0)
     else: self.host,self.level = '',0
示例#4
0
    assert 2 is fun.last((i for i in range(1, 3)))
    assert 0 is fun.last([], default=0)
    print m + ': OK'
except Skip:
    pass
except Exception, e:
    traceback.print_exc()
    print m + ': KO!'
    sys.exit(1)

try:
    m = 'fandango.excepts'
    if not fun.searchCl(a, m): raise Skip()
    import fandango.excepts as f_excepts
    assert 1 == f_excepts.trial(lambda: 1 / 1,
                                lambda e: 10,
                                return_exception=True)
    assert 10 == f_excepts.trial(lambda: 1 / 0,
                                 lambda e: 10,
                                 return_exception=True)
    print m + ': OK'
except Skip:
    pass
except Exception, e:
    traceback.print_exc()
    print m + ': KO!'
    sys.exit(1)

try:
    m = 'fandango.tango'
    if not fun.searchCl(a, m): raise Skip()