mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
tests: Use assertEqual instead of deprecated assertEquals (#11943)
This commit is contained in:
parent
b4d682ca75
commit
f1fc3c762a
@ -34,7 +34,7 @@ class TestAlarmControlPanelManual(unittest.TestCase):
|
|||||||
mock = MagicMock()
|
mock = MagicMock()
|
||||||
add_devices = mock.MagicMock()
|
add_devices = mock.MagicMock()
|
||||||
demo.setup_platform(self.hass, {}, add_devices)
|
demo.setup_platform(self.hass, {}, add_devices)
|
||||||
self.assertEquals(add_devices.call_count, 1)
|
self.assertEqual(add_devices.call_count, 1)
|
||||||
|
|
||||||
def test_arm_home_no_pending(self):
|
def test_arm_home_no_pending(self):
|
||||||
"""Test arm home method."""
|
"""Test arm home method."""
|
||||||
|
@ -272,36 +272,36 @@ class TestSetup(unittest.TestCase):
|
|||||||
hue_light.unthrottled_update_lights(
|
hue_light.unthrottled_update_lights(
|
||||||
self.hass, mock_bridge_two, self.mock_add_devices)
|
self.hass, mock_bridge_two, self.mock_add_devices)
|
||||||
|
|
||||||
self.assertEquals(sorted(mock_bridge_one.lights.keys()), [1, 2])
|
self.assertEqual(sorted(mock_bridge_one.lights.keys()), [1, 2])
|
||||||
self.assertEquals(sorted(mock_bridge_two.lights.keys()), [1, 3])
|
self.assertEqual(sorted(mock_bridge_two.lights.keys()), [1, 3])
|
||||||
|
|
||||||
self.assertEquals(len(self.mock_add_devices.mock_calls), 2)
|
self.assertEqual(len(self.mock_add_devices.mock_calls), 2)
|
||||||
|
|
||||||
# first call
|
# first call
|
||||||
name, args, kwargs = self.mock_add_devices.mock_calls[0]
|
name, args, kwargs = self.mock_add_devices.mock_calls[0]
|
||||||
self.assertEquals(len(args), 1)
|
self.assertEqual(len(args), 1)
|
||||||
self.assertEquals(len(kwargs), 0)
|
self.assertEqual(len(kwargs), 0)
|
||||||
|
|
||||||
# one argument, a list of lights in bridge one; each of them is an
|
# one argument, a list of lights in bridge one; each of them is an
|
||||||
# object of type HueLight so we can't straight up compare them
|
# object of type HueLight so we can't straight up compare them
|
||||||
lights = args[0]
|
lights = args[0]
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
lights[0].unique_id,
|
lights[0].unique_id,
|
||||||
'{}.b1l1.Light.1'.format(hue_light.HueLight))
|
'{}.b1l1.Light.1'.format(hue_light.HueLight))
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
lights[1].unique_id,
|
lights[1].unique_id,
|
||||||
'{}.b1l2.Light.2'.format(hue_light.HueLight))
|
'{}.b1l2.Light.2'.format(hue_light.HueLight))
|
||||||
|
|
||||||
# second call works the same
|
# second call works the same
|
||||||
name, args, kwargs = self.mock_add_devices.mock_calls[1]
|
name, args, kwargs = self.mock_add_devices.mock_calls[1]
|
||||||
self.assertEquals(len(args), 1)
|
self.assertEqual(len(args), 1)
|
||||||
self.assertEquals(len(kwargs), 0)
|
self.assertEqual(len(kwargs), 0)
|
||||||
|
|
||||||
lights = args[0]
|
lights = args[0]
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
lights[0].unique_id,
|
lights[0].unique_id,
|
||||||
'{}.b2l1.Light.1'.format(hue_light.HueLight))
|
'{}.b2l1.Light.1'.format(hue_light.HueLight))
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
lights[1].unique_id,
|
lights[1].unique_id,
|
||||||
'{}.b2l3.Light.3'.format(hue_light.HueLight))
|
'{}.b2l3.Light.3'.format(hue_light.HueLight))
|
||||||
|
|
||||||
@ -313,8 +313,8 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_lights(
|
ret = hue_light.process_lights(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals([], ret)
|
self.assertEqual([], ret)
|
||||||
self.assertEquals(self.mock_bridge.lights, {})
|
self.assertEqual(self.mock_bridge.lights, {})
|
||||||
|
|
||||||
def test_process_lights_no_lights(self):
|
def test_process_lights_no_lights(self):
|
||||||
"""Test the process_lights function when bridge returns no lights."""
|
"""Test the process_lights function when bridge returns no lights."""
|
||||||
@ -325,9 +325,9 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_lights(
|
ret = hue_light.process_lights(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals([], ret)
|
self.assertEqual([], ret)
|
||||||
mock_dispatcher_send.assert_not_called()
|
mock_dispatcher_send.assert_not_called()
|
||||||
self.assertEquals(self.mock_bridge.lights, {})
|
self.assertEqual(self.mock_bridge.lights, {})
|
||||||
|
|
||||||
@patch(HUE_LIGHT_NS + 'HueLight')
|
@patch(HUE_LIGHT_NS + 'HueLight')
|
||||||
def test_process_lights_some_lights(self, mock_hue_light):
|
def test_process_lights_some_lights(self, mock_hue_light):
|
||||||
@ -341,7 +341,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_lights(
|
ret = hue_light.process_lights(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals(len(ret), 2)
|
self.assertEqual(len(ret), 2)
|
||||||
mock_hue_light.assert_has_calls([
|
mock_hue_light.assert_has_calls([
|
||||||
call(
|
call(
|
||||||
1, {'state': 'on'}, self.mock_bridge, mock.ANY,
|
1, {'state': 'on'}, self.mock_bridge, mock.ANY,
|
||||||
@ -353,7 +353,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
self.mock_bridge.allow_in_emulated_hue),
|
self.mock_bridge.allow_in_emulated_hue),
|
||||||
])
|
])
|
||||||
mock_dispatcher_send.assert_not_called()
|
mock_dispatcher_send.assert_not_called()
|
||||||
self.assertEquals(len(self.mock_bridge.lights), 2)
|
self.assertEqual(len(self.mock_bridge.lights), 2)
|
||||||
|
|
||||||
@patch(HUE_LIGHT_NS + 'HueLight')
|
@patch(HUE_LIGHT_NS + 'HueLight')
|
||||||
def test_process_lights_new_light(self, mock_hue_light):
|
def test_process_lights_new_light(self, mock_hue_light):
|
||||||
@ -373,7 +373,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_lights(
|
ret = hue_light.process_lights(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals(len(ret), 1)
|
self.assertEqual(len(ret), 1)
|
||||||
mock_hue_light.assert_has_calls([
|
mock_hue_light.assert_has_calls([
|
||||||
call(
|
call(
|
||||||
2, {'state': 'off'}, self.mock_bridge, mock.ANY,
|
2, {'state': 'off'}, self.mock_bridge, mock.ANY,
|
||||||
@ -382,7 +382,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
])
|
])
|
||||||
mock_dispatcher_send.assert_called_once_with(
|
mock_dispatcher_send.assert_called_once_with(
|
||||||
'hue_light_callback_bridge-id_1')
|
'hue_light_callback_bridge-id_1')
|
||||||
self.assertEquals(len(self.mock_bridge.lights), 2)
|
self.assertEqual(len(self.mock_bridge.lights), 2)
|
||||||
|
|
||||||
def test_process_groups_api_error(self):
|
def test_process_groups_api_error(self):
|
||||||
"""Test the process_groups function when the bridge errors out."""
|
"""Test the process_groups function when the bridge errors out."""
|
||||||
@ -392,8 +392,8 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_groups(
|
ret = hue_light.process_groups(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals([], ret)
|
self.assertEqual([], ret)
|
||||||
self.assertEquals(self.mock_bridge.lightgroups, {})
|
self.assertEqual(self.mock_bridge.lightgroups, {})
|
||||||
|
|
||||||
def test_process_groups_no_state(self):
|
def test_process_groups_no_state(self):
|
||||||
"""Test the process_groups function when bridge returns no status."""
|
"""Test the process_groups function when bridge returns no status."""
|
||||||
@ -405,9 +405,9 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_groups(
|
ret = hue_light.process_groups(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals([], ret)
|
self.assertEqual([], ret)
|
||||||
mock_dispatcher_send.assert_not_called()
|
mock_dispatcher_send.assert_not_called()
|
||||||
self.assertEquals(self.mock_bridge.lightgroups, {})
|
self.assertEqual(self.mock_bridge.lightgroups, {})
|
||||||
|
|
||||||
@patch(HUE_LIGHT_NS + 'HueLight')
|
@patch(HUE_LIGHT_NS + 'HueLight')
|
||||||
def test_process_groups_some_groups(self, mock_hue_light):
|
def test_process_groups_some_groups(self, mock_hue_light):
|
||||||
@ -421,7 +421,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_groups(
|
ret = hue_light.process_groups(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals(len(ret), 2)
|
self.assertEqual(len(ret), 2)
|
||||||
mock_hue_light.assert_has_calls([
|
mock_hue_light.assert_has_calls([
|
||||||
call(
|
call(
|
||||||
1, {'state': 'on'}, self.mock_bridge, mock.ANY,
|
1, {'state': 'on'}, self.mock_bridge, mock.ANY,
|
||||||
@ -433,7 +433,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
self.mock_bridge.allow_in_emulated_hue, True),
|
self.mock_bridge.allow_in_emulated_hue, True),
|
||||||
])
|
])
|
||||||
mock_dispatcher_send.assert_not_called()
|
mock_dispatcher_send.assert_not_called()
|
||||||
self.assertEquals(len(self.mock_bridge.lightgroups), 2)
|
self.assertEqual(len(self.mock_bridge.lightgroups), 2)
|
||||||
|
|
||||||
@patch(HUE_LIGHT_NS + 'HueLight')
|
@patch(HUE_LIGHT_NS + 'HueLight')
|
||||||
def test_process_groups_new_group(self, mock_hue_light):
|
def test_process_groups_new_group(self, mock_hue_light):
|
||||||
@ -453,7 +453,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
ret = hue_light.process_groups(
|
ret = hue_light.process_groups(
|
||||||
self.hass, self.mock_api, self.mock_bridge, None)
|
self.hass, self.mock_api, self.mock_bridge, None)
|
||||||
|
|
||||||
self.assertEquals(len(ret), 1)
|
self.assertEqual(len(ret), 1)
|
||||||
mock_hue_light.assert_has_calls([
|
mock_hue_light.assert_has_calls([
|
||||||
call(
|
call(
|
||||||
2, {'state': 'off'}, self.mock_bridge, mock.ANY,
|
2, {'state': 'off'}, self.mock_bridge, mock.ANY,
|
||||||
@ -462,7 +462,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
])
|
])
|
||||||
mock_dispatcher_send.assert_called_once_with(
|
mock_dispatcher_send.assert_called_once_with(
|
||||||
'hue_light_callback_bridge-id_1')
|
'hue_light_callback_bridge-id_1')
|
||||||
self.assertEquals(len(self.mock_bridge.lightgroups), 2)
|
self.assertEqual(len(self.mock_bridge.lightgroups), 2)
|
||||||
|
|
||||||
|
|
||||||
class TestHueLight(unittest.TestCase):
|
class TestHueLight(unittest.TestCase):
|
||||||
@ -509,27 +509,27 @@ class TestHueLight(unittest.TestCase):
|
|||||||
class_name = "<class 'homeassistant.components.light.hue.HueLight'>"
|
class_name = "<class 'homeassistant.components.light.hue.HueLight'>"
|
||||||
|
|
||||||
light = self.buildLight(info={'uniqueid': 'foobar'})
|
light = self.buildLight(info={'uniqueid': 'foobar'})
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.foobar',
|
class_name+'.foobar',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={})
|
light = self.buildLight(info={})
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.Unnamed Device.Light.42',
|
class_name+'.Unnamed Device.Light.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={'name': 'my-name'})
|
light = self.buildLight(info={'name': 'my-name'})
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.my-name.Light.42',
|
class_name+'.my-name.Light.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={'type': 'my-type'})
|
light = self.buildLight(info={'type': 'my-type'})
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.Unnamed Device.my-type.42',
|
class_name+'.Unnamed Device.my-type.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={'name': 'a name', 'type': 'my-type'})
|
light = self.buildLight(info={'name': 'a name', 'type': 'my-type'})
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.a name.my-type.42',
|
class_name+'.a name.my-type.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
@ -538,28 +538,28 @@ class TestHueLight(unittest.TestCase):
|
|||||||
class_name = "<class 'homeassistant.components.light.hue.HueLight'>"
|
class_name = "<class 'homeassistant.components.light.hue.HueLight'>"
|
||||||
|
|
||||||
light = self.buildLight(info={'uniqueid': 'foobar'}, is_group=True)
|
light = self.buildLight(info={'uniqueid': 'foobar'}, is_group=True)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.foobar',
|
class_name+'.foobar',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={}, is_group=True)
|
light = self.buildLight(info={}, is_group=True)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.Unnamed Device.Group.42',
|
class_name+'.Unnamed Device.Group.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={'name': 'my-name'}, is_group=True)
|
light = self.buildLight(info={'name': 'my-name'}, is_group=True)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.my-name.Group.42',
|
class_name+'.my-name.Group.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(info={'type': 'my-type'}, is_group=True)
|
light = self.buildLight(info={'type': 'my-type'}, is_group=True)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.Unnamed Device.my-type.42',
|
class_name+'.Unnamed Device.my-type.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
|
||||||
light = self.buildLight(
|
light = self.buildLight(
|
||||||
info={'name': 'a name', 'type': 'my-type'},
|
info={'name': 'a name', 'type': 'my-type'},
|
||||||
is_group=True)
|
is_group=True)
|
||||||
self.assertEquals(
|
self.assertEqual(
|
||||||
class_name+'.a name.my-type.42',
|
class_name+'.a name.my-type.42',
|
||||||
light.unique_id)
|
light.unique_id)
|
||||||
|
@ -36,7 +36,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
self.assertTrue(setup_component(
|
self.assertTrue(setup_component(
|
||||||
self.hass, hue.DOMAIN, {}))
|
self.hass, hue.DOMAIN, {}))
|
||||||
mock_phue.Bridge.assert_not_called()
|
mock_phue.Bridge.assert_not_called()
|
||||||
self.assertEquals({}, self.hass.data[hue.DOMAIN])
|
self.assertEqual({}, self.hass.data[hue.DOMAIN])
|
||||||
|
|
||||||
@MockDependency('phue')
|
@MockDependency('phue')
|
||||||
def test_setup_with_host(self, mock_phue):
|
def test_setup_with_host(self, mock_phue):
|
||||||
@ -59,7 +59,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
{'bridge_id': '127.0.0.1'})
|
{'bridge_id': '127.0.0.1'})
|
||||||
|
|
||||||
self.assertTrue(hue.DOMAIN in self.hass.data)
|
self.assertTrue(hue.DOMAIN in self.hass.data)
|
||||||
self.assertEquals(1, len(self.hass.data[hue.DOMAIN]))
|
self.assertEqual(1, len(self.hass.data[hue.DOMAIN]))
|
||||||
|
|
||||||
@MockDependency('phue')
|
@MockDependency('phue')
|
||||||
def test_setup_with_phue_conf(self, mock_phue):
|
def test_setup_with_phue_conf(self, mock_phue):
|
||||||
@ -86,7 +86,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
{'bridge_id': '127.0.0.1'})
|
{'bridge_id': '127.0.0.1'})
|
||||||
|
|
||||||
self.assertTrue(hue.DOMAIN in self.hass.data)
|
self.assertTrue(hue.DOMAIN in self.hass.data)
|
||||||
self.assertEquals(1, len(self.hass.data[hue.DOMAIN]))
|
self.assertEqual(1, len(self.hass.data[hue.DOMAIN]))
|
||||||
|
|
||||||
@MockDependency('phue')
|
@MockDependency('phue')
|
||||||
def test_setup_with_multiple_hosts(self, mock_phue):
|
def test_setup_with_multiple_hosts(self, mock_phue):
|
||||||
@ -122,7 +122,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
], any_order=True)
|
], any_order=True)
|
||||||
|
|
||||||
self.assertTrue(hue.DOMAIN in self.hass.data)
|
self.assertTrue(hue.DOMAIN in self.hass.data)
|
||||||
self.assertEquals(2, len(self.hass.data[hue.DOMAIN]))
|
self.assertEqual(2, len(self.hass.data[hue.DOMAIN]))
|
||||||
|
|
||||||
@MockDependency('phue')
|
@MockDependency('phue')
|
||||||
def test_bridge_discovered(self, mock_phue):
|
def test_bridge_discovered(self, mock_phue):
|
||||||
@ -145,7 +145,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
{'bridge_id': '192.168.0.10'})
|
{'bridge_id': '192.168.0.10'})
|
||||||
|
|
||||||
self.assertTrue(hue.DOMAIN in self.hass.data)
|
self.assertTrue(hue.DOMAIN in self.hass.data)
|
||||||
self.assertEquals(1, len(self.hass.data[hue.DOMAIN]))
|
self.assertEqual(1, len(self.hass.data[hue.DOMAIN]))
|
||||||
|
|
||||||
@MockDependency('phue')
|
@MockDependency('phue')
|
||||||
def test_bridge_configure_and_discovered(self, mock_phue):
|
def test_bridge_configure_and_discovered(self, mock_phue):
|
||||||
@ -175,7 +175,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
mock_load.assert_has_calls(calls_to_mock_load)
|
mock_load.assert_has_calls(calls_to_mock_load)
|
||||||
|
|
||||||
self.assertTrue(hue.DOMAIN in self.hass.data)
|
self.assertTrue(hue.DOMAIN in self.hass.data)
|
||||||
self.assertEquals(1, len(self.hass.data[hue.DOMAIN]))
|
self.assertEqual(1, len(self.hass.data[hue.DOMAIN]))
|
||||||
|
|
||||||
# Then we discover the same bridge
|
# Then we discover the same bridge
|
||||||
hue.bridge_discovered(self.hass, mock_service, discovery_info)
|
hue.bridge_discovered(self.hass, mock_service, discovery_info)
|
||||||
@ -189,7 +189,7 @@ class TestSetup(unittest.TestCase):
|
|||||||
|
|
||||||
# Still only one
|
# Still only one
|
||||||
self.assertTrue(hue.DOMAIN in self.hass.data)
|
self.assertTrue(hue.DOMAIN in self.hass.data)
|
||||||
self.assertEquals(1, len(self.hass.data[hue.DOMAIN]))
|
self.assertEqual(1, len(self.hass.data[hue.DOMAIN]))
|
||||||
|
|
||||||
|
|
||||||
class TestHueBridge(unittest.TestCase):
|
class TestHueBridge(unittest.TestCase):
|
||||||
|
@ -35,11 +35,11 @@ class TestNuHeat(unittest.TestCase):
|
|||||||
|
|
||||||
mocked_nuheat.NuHeat.assert_called_with("warm", "feet")
|
mocked_nuheat.NuHeat.assert_called_with("warm", "feet")
|
||||||
self.assertIn(nuheat.DOMAIN, self.hass.data)
|
self.assertIn(nuheat.DOMAIN, self.hass.data)
|
||||||
self.assertEquals(2, len(self.hass.data[nuheat.DOMAIN]))
|
self.assertEqual(2, len(self.hass.data[nuheat.DOMAIN]))
|
||||||
self.assertIsInstance(
|
self.assertIsInstance(
|
||||||
self.hass.data[nuheat.DOMAIN][0], type(mocked_nuheat.NuHeat())
|
self.hass.data[nuheat.DOMAIN][0], type(mocked_nuheat.NuHeat())
|
||||||
)
|
)
|
||||||
self.assertEquals(self.hass.data[nuheat.DOMAIN][1], "thermostat123")
|
self.assertEqual(self.hass.data[nuheat.DOMAIN][1], "thermostat123")
|
||||||
|
|
||||||
mocked_load.assert_called_with(
|
mocked_load.assert_called_with(
|
||||||
self.hass, "climate", nuheat.DOMAIN, {}, self.config
|
self.hass, "climate", nuheat.DOMAIN, {}, self.config
|
||||||
|
@ -101,8 +101,8 @@ class TestPlant(unittest.TestCase):
|
|||||||
{ATTR_UNIT_OF_MEASUREMENT: 'us/cm'})
|
{ATTR_UNIT_OF_MEASUREMENT: 'us/cm'})
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get('plant.'+plant_name)
|
state = self.hass.states.get('plant.'+plant_name)
|
||||||
self.assertEquals(STATE_PROBLEM, state.state)
|
self.assertEqual(STATE_PROBLEM, state.state)
|
||||||
self.assertEquals(5, state.attributes[plant.READING_MOISTURE])
|
self.assertEqual(5, state.attributes[plant.READING_MOISTURE])
|
||||||
|
|
||||||
@pytest.mark.skipif(plant.ENABLE_LOAD_HISTORY is False,
|
@pytest.mark.skipif(plant.ENABLE_LOAD_HISTORY is False,
|
||||||
reason="tests for loading from DB are instable, thus"
|
reason="tests for loading from DB are instable, thus"
|
||||||
@ -132,10 +132,10 @@ class TestPlant(unittest.TestCase):
|
|||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
|
|
||||||
state = self.hass.states.get('plant.'+plant_name)
|
state = self.hass.states.get('plant.'+plant_name)
|
||||||
self.assertEquals(STATE_UNKNOWN, state.state)
|
self.assertEqual(STATE_UNKNOWN, state.state)
|
||||||
max_brightness = state.attributes.get(
|
max_brightness = state.attributes.get(
|
||||||
plant.ATTR_MAX_BRIGHTNESS_HISTORY)
|
plant.ATTR_MAX_BRIGHTNESS_HISTORY)
|
||||||
self.assertEquals(30, max_brightness)
|
self.assertEqual(30, max_brightness)
|
||||||
|
|
||||||
def test_brightness_history(self):
|
def test_brightness_history(self):
|
||||||
"""Test the min_brightness check."""
|
"""Test the min_brightness check."""
|
||||||
@ -149,19 +149,19 @@ class TestPlant(unittest.TestCase):
|
|||||||
{ATTR_UNIT_OF_MEASUREMENT: 'lux'})
|
{ATTR_UNIT_OF_MEASUREMENT: 'lux'})
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get('plant.'+plant_name)
|
state = self.hass.states.get('plant.'+plant_name)
|
||||||
self.assertEquals(STATE_PROBLEM, state.state)
|
self.assertEqual(STATE_PROBLEM, state.state)
|
||||||
|
|
||||||
self.hass.states.set(BRIGHTNESS_ENTITY, 600,
|
self.hass.states.set(BRIGHTNESS_ENTITY, 600,
|
||||||
{ATTR_UNIT_OF_MEASUREMENT: 'lux'})
|
{ATTR_UNIT_OF_MEASUREMENT: 'lux'})
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get('plant.'+plant_name)
|
state = self.hass.states.get('plant.'+plant_name)
|
||||||
self.assertEquals(STATE_OK, state.state)
|
self.assertEqual(STATE_OK, state.state)
|
||||||
|
|
||||||
self.hass.states.set(BRIGHTNESS_ENTITY, 100,
|
self.hass.states.set(BRIGHTNESS_ENTITY, 100,
|
||||||
{ATTR_UNIT_OF_MEASUREMENT: 'lux'})
|
{ATTR_UNIT_OF_MEASUREMENT: 'lux'})
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
state = self.hass.states.get('plant.'+plant_name)
|
state = self.hass.states.get('plant.'+plant_name)
|
||||||
self.assertEquals(STATE_OK, state.state)
|
self.assertEqual(STATE_OK, state.state)
|
||||||
|
|
||||||
|
|
||||||
class TestDailyHistory(unittest.TestCase):
|
class TestDailyHistory(unittest.TestCase):
|
||||||
@ -195,4 +195,4 @@ class TestDailyHistory(unittest.TestCase):
|
|||||||
|
|
||||||
for i in range(len(days)):
|
for i in range(len(days)):
|
||||||
dh.add_measurement(values[i], days[i])
|
dh.add_measurement(values[i], days[i])
|
||||||
self.assertEquals(max_values[i], dh.max)
|
self.assertEqual(max_values[i], dh.max)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user