def __init__(self, weight, syn_or_asyn): """constructor; validates input and inits instance; args, see class""" DirectComponent.__init__(self, weight) if (aux.is_int(syn_or_asyn, 'syn_or_asyn') and aux.is_in_list(syn_or_asyn, (1, -1), 'syn_or_asyn')): self.syn_or_asyn = syn_or_asyn self.last_in_val = 0.0 self.last_out_val = 0.0
def __init__(self, weight): """constructor; validates input and inits instance; args, see class""" GoalComponent.__init__(self) if aux.is_int(weight, 'weight') and aux.is_pos(weight, 'weight'): self.weight = weight
def test_is_int(self): self.assertTrue(aux.is_int(42, 'test')) self.assertTrue(aux.is_int(3//2, 'test')) self.assertRaises(TypeError, aux.is_int, 3.5, 'test') self.assertRaises(TypeError, aux.is_int, '42', 'test') self.assertRaises(TypeError, aux.is_int, None, 'test')