コード例 #1
0
 def test_can_set_via_color_tuple(self):
     color = (128, 128, 128)
     s = LightSettings()
     s.set_color(color)
     self.assertEquals(s.red, 128)
     self.assertEquals(s.blue, 128)
     self.assertEquals(s.green, 128)
コード例 #2
0
 def test_can_dim_lights_uniformly(self):
     color = (100, 100, 100)
     s = LightSettings()
     s.set_color(color)
     s.dim(75)
     self.assertEquals(s.red, 75)
     self.assertEquals(s.green, 75)
     self.assertEquals(s.blue, 75)
コード例 #3
0
    def test_can_compare_settings_for_equivalence(self):
        color = (100, 100, 100)
        s = LightSettings()
        s.set_color(color)

        s2 = LightSettings()
        s2.set_color(color)

        self.assertEquals(s, s2)
        self.assertFalse(s is s2)
コード例 #4
0
    def test_can_compare_settings_to_tuple(self):
        color = (100, 100, 100)
        s = LightSettings()
        s.set_color(color)

        self.assertEquals(s, color)