Change STATE_UNKOWN to None (#20337)
* Change STATE_UNKOWN to None * Change STATE_UNKOWN to None * tests * tests * tests * tests * tests * style * fix comments * fix comments * update fan test
This commit is contained in:
1 parent
074fcd96ed
commit
1bd31e3459
64 files changed
+147
-168
No files matched your search
@@ -27,7 +27,7 @@ class TestFanEntity(unittest.TestCase):
|
||||
|
||||
def test_fanentity(self):
|
||||
"""Test fan entity methods."""
|
||||
assert 'on' == self.fan.state
|
||||
assert 'off' == self.fan.state
|
||||
assert 0 == len(self.fan.speed_list)
|
||||
assert 0 == self.fan.supported_features
|
||||
assert {'speed_list': []} == self.fan.state_attributes
|
||||
|
||||
@@ -5,7 +5,7 @@ import unittest
|
||||
from voluptuous.error import MultipleInvalid
|
||||
|
||||
from homeassistant.const import (
|
||||
STATE_OFF, STATE_ON, STATE_UNKNOWN, STATE_PLAYING, STATE_PAUSED)
|
||||
STATE_OFF, STATE_ON, STATE_PLAYING, STATE_PAUSED)
|
||||
import homeassistant.components.switch as switch
|
||||
import homeassistant.components.input_number as input_number
|
||||
import homeassistant.components.input_select as input_select
|
||||
@@ -119,7 +119,7 @@ class MockMediaPlayer(media_player.MediaPlayerDevice):
|
||||
|
||||
def turn_on(self):
|
||||
"""Mock turn_on function."""
|
||||
self._state = STATE_UNKNOWN
|
||||
self._state = None
|
||||
|
||||
def turn_off(self):
|
||||
"""Mock turn_off function."""
|
||||
|
||||
@@ -12,7 +12,6 @@ from unittest.mock import Mock
|
||||
import asynctest
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.sensor.dsmr import DerivativeDSMREntity
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
import pytest
|
||||
from tests.common import assert_setup_component
|
||||
|
||||
@@ -99,7 +98,7 @@ def test_derivative():
|
||||
entity = DerivativeDSMREntity('test', '1.0.0')
|
||||
yield from entity.async_update()
|
||||
|
||||
assert entity.state == STATE_UNKNOWN, 'initial state not unknown'
|
||||
assert entity.state is None, 'initial state not unknown'
|
||||
|
||||
entity.telegram = {
|
||||
'1.0.0': MBusObject([
|
||||
@@ -109,7 +108,7 @@ def test_derivative():
|
||||
}
|
||||
yield from entity.async_update()
|
||||
|
||||
assert entity.state == STATE_UNKNOWN, \
|
||||
assert entity.state is None, \
|
||||
'state after first update should still be unknown'
|
||||
|
||||
entity.telegram = {
|
||||
|
||||
@@ -169,7 +169,7 @@ class TestGoogleWifiSensor(unittest.TestCase):
|
||||
sensor = self.sensor_dict[name]['sensor']
|
||||
self.fake_delay(2)
|
||||
sensor.update()
|
||||
assert STATE_UNKNOWN == sensor.state
|
||||
assert sensor.state is None
|
||||
|
||||
@requests_mock.Mocker()
|
||||
def test_update_when_value_changed(self, mock_req):
|
||||
@@ -213,7 +213,7 @@ class TestGoogleWifiSensor(unittest.TestCase):
|
||||
for name in self.sensor_dict:
|
||||
sensor = self.sensor_dict[name]['sensor']
|
||||
sensor.update()
|
||||
assert STATE_UNKNOWN == sensor.state
|
||||
assert sensor.state is None
|
||||
|
||||
def update_side_effect(self):
|
||||
"""Mock representation of update function."""
|
||||
|
||||
@@ -11,7 +11,6 @@ from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.setup import setup_component
|
||||
import homeassistant.components.sensor as sensor
|
||||
import homeassistant.components.sensor.rest as rest
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.helpers.config_validation import template
|
||||
|
||||
from tests.common import get_test_home_assistant, assert_setup_component
|
||||
@@ -175,7 +174,7 @@ class TestRestSensor(unittest.TestCase):
|
||||
self.rest.update = Mock(
|
||||
'rest.RestData.update', side_effect=self.update_side_effect(None))
|
||||
self.sensor.update()
|
||||
assert STATE_UNKNOWN == self.sensor.state
|
||||
assert self.sensor.state is None
|
||||
assert not self.sensor.available
|
||||
|
||||
def test_update_when_value_changed(self):
|
||||
|
||||
Reference in new issue
Block a user