def test_invalid_red_value_throws(self):
     s = LightSettings()
     with self.assertRaises(ValueError):
         s.red = -10
     with self.assertRaises(ValueError):
         s.red = 300
 def test_can_serialize_to_json(self):
     s = LightSettings()
     s.red = 10
     jsonstr = s.to_json()
     self.assertEquals(jsonstr, '{"red": 10}')
 def test_can_set_red(self):
     s = LightSettings()
     s.red = 10
     self.assertEquals(s.red, 10)