visitor pattern class clock(object)def __init__(selfname)self name name self status self get_status(def get_status(self)return "{}:{}format(random randrange( )random randrange( )def is_online(self)return true def boot_up(self)self status " : class homeautomationboottests(unittest testcase)def setup(self)self thermostat thermostat("general thermostat"self thermal_regulator temperatureregulator("thermal regulator"self front_door_lock doorlock("front door lock"self coffee_machine coffeemachine("coffee machine"self bedroom_light light("bedroom light"self system_clock clock("system clock"def test_boot_thermostat_does_nothing_to_state(self)state_before self thermostat status self thermostat boot_up(self assertequal(state_beforeself thermostat statusdef test_boot_thermal_regulator_turns_it_on(self)self thermal_regulator boot_up(self assertequal(self thermal_regulator status'on'def test_boot_front_door_lock_does_nothing_to_state(self)state_before self front_door_lock status self front_door_lock boot_up(self assertequal(state_beforeself front_door_lock statusdef test_boot_coffee_machine_turns_it_on(self)self coffee_machine boot_up(self assertequal(self coffee_machine status