예제 #1
0
class LampController:
    def __init__(self):
        self.lamp = Lamp()

    def set_on(self):
        # Change lamp status to ON
        self.lamp.set_on()

    def get_status(self):
        # Returns True if lamp is ON
        return self.lamp.is_on()
예제 #2
0
class LampController:
    def __init__(self):
        self.lamp = Lamp()

    def turn_on(self):
        self.lamp.turn_on()

    def turn_off(self):
        pass

    def is_on(self):
        return self.lamp.state
예제 #3
0
class LampController:
    def __init__(self):
        self.lamp = Lamp()

    def turn_on(self):
        self.lamp.set_on()

    def turn_off(self):
        self.lamp.set_off()

    def is_on(self):
        return self.lamp.get_state()
예제 #4
0
 def test_set_off(self):
     lamp =  {'ID' : 1, 'lamp' : Lamp()}
     self.lamps.add_lamp(lamp)
     self.lamps.set_off()
     self.assertFalse(self.lamps.is_on())
예제 #5
0
 def test_remove_lamp(self):
     lista = []
     lamp =  {'ID' : 1, 'lamp' : Lamp()}
     self.lamps.add_lamp(lamp)
     self.lamps.remove_lamp(lamp)
     self.assertEqual(lista, self.lamps.get_list())
예제 #6
0
 def create_lamp(self, id):
     lamp = Lamp()
     dic = {'ID': id, 'lamp': lamp}
     self.lamps.append(dic)
예제 #7
0
 def __init__(self):
     self.lamp = Lamp()
예제 #8
0
 def create_simple_lamp(self, lamp_id):
     self.all_lamps.append(Lamp(lamp_id), lamp_id)