hass-core/tests/components/fan/test_init.py
Daniel Høyer Iversen 1bd31e3459 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
2019-01-24 08:20:20 +01:00

41 lines
1.1 KiB
Python

"""Tests for fan platforms."""
import unittest
from homeassistant.components.fan import FanEntity
import pytest
class BaseFan(FanEntity):
"""Implementation of the abstract FanEntity."""
def __init__(self):
"""Initialize the fan."""
pass
class TestFanEntity(unittest.TestCase):
"""Test coverage for base fan entity class."""
def setUp(self):
"""Set up test data."""
self.fan = BaseFan()
def tearDown(self):
"""Tear down unit test data."""
self.fan = None
def test_fanentity(self):
"""Test fan entity methods."""
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
# Test set_speed not required
self.fan.oscillate(True)
with pytest.raises(NotImplementedError):
self.fan.set_speed('slow')
with pytest.raises(NotImplementedError):
self.fan.turn_on()
with pytest.raises(NotImplementedError):
self.fan.turn_off()