def test_initialization(self): switch = LightSwitch() assert isinstance(switch, LightSwitch) assert isinstance(switch, Switchable)
def _construct_light_switch_client(): switch = LightSwitch() open_command = OpenSwitchCommand(switch) close_command = CloseSwitchCommand(switch) return Client(open_command, close_command)
def test_execute_open_switch_command_with_light_switch(self): command = OpenSwitchCommand(LightSwitch()) assert command.execute() == "The light turned off."
def test_initialization(self): command = OpenSwitchCommand(LightSwitch()) assert isinstance(command, OpenSwitchCommand) assert isinstance(command, Command)
def test_execute_close_switch_command_with_light_switch(self): command = CloseSwitchCommand(LightSwitch()) assert command.execute() == "The light turned on."
def test_turn_off_light_switch(self): switch = LightSwitch() assert switch.turn_off() == "The light turned off."
def test_turn_on_light_switch(self): switch = LightSwitch() assert switch.turn_on() == "The light turned on."