mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Coerce RGB and XY color values to tuples instead of lists.
This commit is contained in:
@@ -170,8 +170,8 @@ class TestLight(unittest.TestCase):
|
||||
light.turn_on(self.hass, dev1.entity_id,
|
||||
transition=10, brightness=20)
|
||||
light.turn_on(
|
||||
self.hass, dev2.entity_id, rgb_color=[255, 255, 255])
|
||||
light.turn_on(self.hass, dev3.entity_id, xy_color=[.4, .6])
|
||||
self.hass, dev2.entity_id, rgb_color=(255, 255, 255))
|
||||
light.turn_on(self.hass, dev3.entity_id, xy_color=(.4, .6))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
|
||||
@@ -182,10 +182,10 @@ class TestLight(unittest.TestCase):
|
||||
data)
|
||||
|
||||
method, data = dev2.last_call('turn_on')
|
||||
self.assertEquals(data[light.ATTR_RGB_COLOR], [255, 255, 255])
|
||||
self.assertEquals(data[light.ATTR_RGB_COLOR], (255, 255, 255))
|
||||
|
||||
method, data = dev3.last_call('turn_on')
|
||||
self.assertEqual({light.ATTR_XY_COLOR: [.4, .6]}, data)
|
||||
self.assertEqual({light.ATTR_XY_COLOR: (.4, .6)}, data)
|
||||
|
||||
# One of the light profiles
|
||||
prof_name, prof_x, prof_y, prof_bri = 'relax', 0.5119, 0.4147, 144
|
||||
@@ -195,20 +195,20 @@ class TestLight(unittest.TestCase):
|
||||
# Specify a profile and attributes to overwrite it
|
||||
light.turn_on(
|
||||
self.hass, dev2.entity_id,
|
||||
profile=prof_name, brightness=100, xy_color=[.4, .6])
|
||||
profile=prof_name, brightness=100, xy_color=(.4, .6))
|
||||
|
||||
self.hass.pool.block_till_done()
|
||||
|
||||
method, data = dev1.last_call('turn_on')
|
||||
self.assertEqual(
|
||||
{light.ATTR_BRIGHTNESS: prof_bri,
|
||||
light.ATTR_XY_COLOR: [prof_x, prof_y]},
|
||||
light.ATTR_XY_COLOR: (prof_x, prof_y)},
|
||||
data)
|
||||
|
||||
method, data = dev2.last_call('turn_on')
|
||||
self.assertEqual(
|
||||
{light.ATTR_BRIGHTNESS: 100,
|
||||
light.ATTR_XY_COLOR: [.4, .6]},
|
||||
light.ATTR_XY_COLOR: (.4, .6)},
|
||||
data)
|
||||
|
||||
# Test shitty data
|
||||
@@ -278,5 +278,5 @@ class TestLight(unittest.TestCase):
|
||||
method, data = dev1.last_call('turn_on')
|
||||
|
||||
self.assertEqual(
|
||||
{light.ATTR_XY_COLOR: [.4, .6], light.ATTR_BRIGHTNESS: 100},
|
||||
{light.ATTR_XY_COLOR: (.4, .6), light.ATTR_BRIGHTNESS: 100},
|
||||
data)
|
||||
|
||||
Reference in New Issue
Block a user