def test_quick_timer(self): hours = random.randint(0, 9) minutes = random.randint(0, 59) Pump(1).quick_timer = [hours, minutes] self.assertEqual(Pump(1).quick_timer, [hours, minutes]) Pump(1).quick_timer = [0, 10] self.assertEqual(Pump(1).quick_timer, [0, 10])
def test_time_out_timer(self): hours = random.randint(0, 9) minutes = random.randint(0, 59) Pump(1).time_out_timer = [hours, minutes] self.assertEqual(Pump(1).time_out_timer, [hours, minutes]) Pump(1).time_out_timer = [3, 0] self.assertEqual(Pump(1).time_out_timer, [3, 0])
def test_rpm(self): for program in Pump(1).programs: rpm = random.randint(2000, 3000) program.rpm = rpm self.assertEqual(Pump(1).program(program.index).rpm, rpm) program.rpm = 1100 self.assertEqual(Pump(1).program(program.index).rpm, 1100)
def test_set_rpm(self): for rpm in [3000, 2500, 2000, 1100]: with self.subTest(rpm=rpm): Pump(1).rpm = rpm self.assertEqual(Pump(1).rpm, rpm) # Ugly formula below is best-fit polynomial to manually collected data. # Across the usable rpm range, deviation stays <100 watts self.assertAlmostEqual(Pump(1).watts, 0.0004 * (rpm**2) - 0.8 * rpm + 611, delta=100)
def test_mode(self): Pump(1).speed(1).mode = "EGG_TIMER" self.assertEqual(Pump(1).speed(1).mode, "EGG_TIMER") Pump(1).speed(1).mode = 0 self.assertEqual(Pump(1).speed(1).mode, "MANUAL") Pump(1).speed(5).mode = "SCHEDULE" self.assertEqual(Pump(1).speed(5).mode, "SCHEDULE") Pump(1).speed(5).mode = 3 self.assertEqual(Pump(1).speed(5).mode, "DISABLED")
def test_fahrenheit(self): Pump(1).fahrenheit = 1 self.assertEqual(Pump(1).fahrenheit, 1) self.assertEqual(Pump(1).celsius, 0) Pump(1).fahrenheit = 0 self.assertEqual(Pump(1).fahrenheit, 0) self.assertEqual(Pump(1).celsius, 1)
def test_id(self): Pump(1).id = 2 self.assertEqual(Pump(2).address, 97) self.assertEqual(Pump(2).id, 2) Pump(2).id = 1 self.assertEqual(Pump(1).address, 96) self.assertEqual(Pump(1).id, 1)
def test_schedule_end(self): Pump(1).speed(1).schedule_end = [7, 1] self.assertEqual(Pump(1).speed(1).schedule_end, [7, 1]) Pump(1).speed(1).schedule_end = [18, 0] self.assertEqual(Pump(1).speed(1).schedule_end, [18, 0])
def test_schedule_start(self): Pump(1).speed(1).schedule_start = [7, 1] self.assertEqual(Pump(1).speed(1).schedule_start, [7, 1]) Pump(1).speed(1).schedule_start = [11, 0] self.assertEqual(Pump(1).speed(1).schedule_start, [11, 0])
def test_power_off(self): Pump(1).power = False self.assertEqual(Pump(1).power, False)
def test_antifreeze_enable(self): Pump(1).antifreeze_enable = False self.assertEqual(Pump(1).antifreeze_enable, False) Pump(1).antifreeze_enable = True self.assertEqual(Pump(1).antifreeze_enable, True)
def test_address(self): Pump(1).address = 97 self.assertEqual(Pump(2).address, 97) Pump(2).address = 96 self.assertEqual(Pump(1).address, 96)
def test_programs(self): for x in range(1, 4): Pump(1).running_program = x self.assertEqual(Pump(1).running_program, x)
def test_prime_sensitivity(self): sens = random.randint(1, 100) Pump(1).prime_sensitivity = sens self.assertEqual(Pump(1).prime_sensitivity, sens) Pump(1).prime_sensitivity = 3 self.assertEqual(Pump(1).prime_sensitivity, 3)
def test_svrs_restart_timer(self): seconds = random.randint(30, 300) Pump(1).svrs_restart_timer = seconds self.assertEqual(Pump(1).svrs_restart_timer, seconds) Pump(1).svrs_restart_timer = 120 self.assertEqual(Pump(1).svrs_restart_timer, 120)
def test_power_on(self): Pump(1).power = True self.assertEqual(Pump(1).power, True)
def test_svrs_restart_enable(self): Pump(1).svrs_restart_enable = False self.assertEqual(Pump(1).svrs_restart_enable, False) Pump(1).svrs_restart_enable = True self.assertEqual(Pump(1).svrs_restart_enable, True)
def test_antifreeze_temp(self): temp = random.randint(40, 50) Pump(1).antifreeze_temp = temp self.assertEqual(Pump(1).antifreeze_temp, temp) Pump(1).antifreeze_temp = 40 self.assertEqual(Pump(1).antifreeze_temp, 40)
def test_antifreeze_rpm(self): rpm = random.randint(2000, 3000) Pump(1).antifreeze_rpm = rpm self.assertEqual(Pump(1).antifreeze_rpm, rpm) Pump(1).antifreeze_rpm = 1100 self.assertEqual(Pump(1).antifreeze_rpm, 1100)
def test_egg_timer(self): for speed in Pump(1).speeds: speed.egg_timer = [7, 1] self.assertEqual(Pump(1).speed(speed.index).egg_timer, [7, 1]) speed.egg_timer = [0, 5] self.assertEqual(Pump(1).speed(speed.index).egg_timer, [0, 5])
def test_prime_enable(self): Pump(1).prime_enable = False self.assertEqual(Pump(1).prime_enable, False) Pump(1).prime_enable = True self.assertEqual(Pump(1).prime_enable, True)
def test_soft_prime_counter(self): self.assertEqual(Pump(1).soft_prime_counter, 10)
def test_ramp(self): Pump(1).ramp = 100 self.assertEqual(Pump(1).ramp, 100) Pump(1).ramp = 200 self.assertEqual(Pump(1).ramp, 200)
def test_ampm(self): Pump(1).ampm = False self.assertEqual(Pump(1).ampm, False) Pump(1).ampm = True self.assertEqual(Pump(1).ampm, True)
def test_contrast(self): Pump(1).contrast = 1 self.assertEqual(Pump(1).contrast, 1) Pump(1).contrast = 3 self.assertEqual(Pump(1).contrast, 3)
def test_prime_max_time(self): time = random.randint(1, 30) Pump(1).prime_max_time = time self.assertEqual(Pump(1).prime_max_time, time) Pump(1).prime_max_time = 11 self.assertEqual(Pump(1).prime_max_time, 11)
def test_rpm(self): Pump(1).speed(1).rpm = 2000 self.assertEqual(Pump(1).speed(1).rpm, 2000) Pump(1).speed(1).rpm = 1100 self.assertEqual(Pump(1).speed(1).rpm, 1100)
def test_prime_delay(self): delay = random.randint(1, 600) Pump(1).prime_delay = delay self.assertEqual(Pump(1).prime_delay, delay) Pump(1).prime_delay = 20 self.assertEqual(Pump(1).prime_delay, 20)
def test_max_speed(self): Pump(1).max_speed = 3445 self.assertEqual(Pump(1).max_speed, 3445) Pump(1).max_speed = 3450 self.assertEqual(Pump(1).max_speed, 3450)
def test_quick_clean(self): rpm = random.randint(2000, 3000) Pump(1).quick_rpm = rpm self.assertEqual(Pump(1).quick_rpm, rpm) Pump(1).quick_rpm = 2000 self.assertEqual(Pump(1).quick_rpm, 2000)