def test_screen(self): tv = TV tv.tv_display(tv) tv.dvd_display(tv) self.assertEquals(tv.tv_display(tv), TV.tv_display(TV)) self.assertEquals(tv.dvd_display(tv), TV.dvd_display(TV))
def test_screen(self): remote = Remote remote.display_channel(TV) remote.display_dvd(TV) self.assertEquals(remote.display_channel(TV), TV.tv_display()) self.assertEquals(remote.display_channel(TV), TV.dvd_display())
def test_volume(self): tv = TV tv.volume_up(tv) tv.volume_down(tv) self.assertEquals(tv.volume_up(tv), tv.volume) self.assertEquals(tv.volume_down(tv), TV.volume_down(TV))
def test_user_tv(self): john = User("John") command = "tv_mood" john.tv_switch(command) self.assertEquals(john.name, "John") self.assertEquals(john.tv_switch(command), TV.tv_display(TV))
import json from Lights import Lights, LightStates from TV import TV, TVStates from flask import Flask, render_template, current_app, request from flask_ask import Ask, statement app = Flask(__name__) ask = Ask(app, '/remote/') light_thread = Lights(1, "Lights-1", 1) light_thread.start() tv_thread = TV(2, "Tv-1", 2) tv_thread.start() @ask.launch def launch(): message = "Hello Kaylie. I am the Alexa Remote. " \ "You can ask me to power on or off the tv, turn volume up or down, and change inputs. " \ "What would you like to do?" return statement(message) @ask.intent('TVPowerOn') def power_on(): if tv_thread.power_tv(True): message = "TV has been turned on" else: message = "TV is already on" return statement(message)
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(30) tv1.setVolume(3)
from typing import Tuple, List, Set, Dict from AirConditining import AirConditining from HairDrier import HairDrier from Refrigerator import Refrigerator from TV import TV from WashingMachine import WashingMachine from HouseManager import HouseManager if __name__=='__main__': air = AirConditining(2, "Sakuto", 185, 15) drier = HairDrier(3,"kjfke", 125, 3) ref = Refrigerator(4, "prioek", 700, 295.6) tv = TV(5, "jdkwjd", 450, 21) wash = WashingMachine(6, "iieoeo", 489, 5) manager = HouseManager() manager.house_device_list = [air, drier, ref, tv, wash] manager.print_list(manager.house_device_list) print("\n\n\n") print(manager.consumer_power()) print("\n\n\n") manager.print_list(manager.search_by_producer("Sakuto")) print("\n\n\n") manager.print_list(manager.sort_by_power())
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(30) tv1.setVol(4) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print("tv1's channel is ", tv1.getchannel(), "and volume level", tv1.getVol()) print("tv2's channel is ", tv2.getchannel(), "and volume level", tv2.getVol())
def tv_off(self): device = TV() device.off() return
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(30) tv1.setVolumeLevel(3) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print("tv1의 채널은", tv1.getChannel(), "이고 음량 크기는", tv1.getVolumeLevel(), "입니다.") print("tv2의 채널은", tv2.getChannel(), "이고 음량 크기는", tv2.getVolumeLevel(), "입니다.")
from TV import TV testTV = TV(80, "1080p", "Samsung", "tv", ["HDMI 1", "HDMI 2", "Component"], "Optical Audio", False, "HDMI 1", 0.5, 0.5) print(getattr(testTV, "make")) setattr(testTV, "make", "LG") print(getattr(testTV, "make")) print(getattr(testTV, "isOn")) testTV.togglePower("isOn") print(getattr(testTV, "isOn"))
from TV import TV from heater import Heater from oven import Oven class Kitchen(): def __init__(self, size): self.size = size self.tv = None self.heater = None self.oven = None jakub_tv = TV(40, 50, True) jakub_heater = Heater("small", "1.6kw") jakub_oven = Oven(150, 200, 56, "electronic", "black") jakub_kitchen = Kitchen("large") jakub_kitchen.tv = jakub_tv jakub_kitchen.heater = jakub_heater print(jakub_kitchen.tv) print(jakub_heater) print(jakub_oven)
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(30) tv1.setVolume(3) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print("tv1 channel: ", tv1.getChannel(), "Volume:", tv1.getVolume()) print("tv2 channel: ", tv2.getChannel(), "Volume:", tv2.getVolume())
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(30) tv1.setVolume(3) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print("tv1's channel is {} and volume level is {}.".format( tv1.getChannel(), tv1.getVolumeLevel())) print("tv2's channel is {} and volume level is {}.".format( tv2.getChannel(), tv2.getVolumeLevel()))
def __init__(self, tv): super().__init__(tv) def button1(self): self.television.power() def button2(self): self.televsion.volume += 5 def button3(self): self.televsion.volume -= 4 def button4(self): super().button4() print("Explode") def button5(self): print("apple") if __name__ == "__main__": tv1 = TV("Samsung", " 'Smart' TV") r1 = SamsungRemote(tv1) r1.button1() print(tv1.state) r1.button2() print(tv1.volume) r1.button4() r1.button5()
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(10) tv1.setVolume(3) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print( f"tv1's channel is {tv1.getChannel()} and volume level is {tv1.getVolumeLevel()}." ) print( f"tv2's channel is {tv2.getChannel()} and volume is {tv2.getVolumeLevel()}." )
def main(): tv1 = TV() tv1.turnOn() tv1.setChannel(30) tv1.setVolume(3) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print("tv1's channel is", tv1.getChannel(), "and volume level is", tv1.getVolumeLevel()) print("tv2's channel is", tv2.getChannel(), "and volume level is", tv2.getVolumeLevel())
def main(): # tv1 is going to be a new TV object tv1 = TV() # gonna call all these methods on our new tv1 object tv1.turnOn() tv1.setChannel(30) tv1.setVolume(3) tv2 = TV() tv2.turnOn() tv2.channelUp() tv2.channelUp() tv2.volumeUp() print("tv1's channel is", tv1.getChannel(), "and volume level is", tv1.getVolumeLevel()) print("tv2's channel is", tv2.getChannel(), "and volume level is", tv2.getVolumeLevel())