コード例 #1
0
    def test_detects_cycles(self):
        ls = LightSettings()
        ls2 = LightSettings()
        ls3 = LightSettings()
        # make a cycle
        ls.next_settings = ls2
        ls2.next_settings = ls3
        ls3.next_settings = ls

        mod = Modifier()
        mod.modify(ls)
        self.assertIsNotNone(ls)
コード例 #2
0
ファイル: testraspi.py プロジェクト: jdiller/lightcontroller
 def test_can_transition_one_way(self):
     raspi = RasPi(self.mockconfig)
     settings = LightSettings(red=0, green=0, blue=0)
     settings2 = LightSettings(red=255, green=255, blue=255)
     settings.next_settings = settings2
     settings.on_duration = 0.015
     settings2.transition_time = 0.015
     raspi.apply_settings(settings)
     for led in raspi.leds:
         self.assertEquals(0, raspi.get_PWM_dutycycle(led))
     gevent.sleep(0.07)
     for led in raspi.leds:
         self.assertEquals(255, raspi.get_PWM_dutycycle(led))