Fan demo (#2976)
* Update attr to property and default state method * State prop is defined in parent class * Demo platform fan * PyDoc * Copy-pasta artifact * PyDoc * Linting * Raise error if turn_off and turn_on not implemented * Update demo platform * Initial unit test commit * Readability * Unneeded typing * Should inherit from fan entity * Turn off polling * Initial oscillating flag * Pass HASS into demo * Typing * Invoke set_speed instead of setting directly * Service update * Update demo tests * Forgot to block after service call. * linting * Test to make sure not implemented is thrown * Is On Method test * Update const to match string * Update services yaml * Toggle method * Toggle service * Typing * TYPE O * Attribute check * Type-o * Type-o * Put typing back * ToggleEntity * Linting * Linting * Oops * Stale prints * Demo support
This commit is contained in:
1 parent
a4b90c9879
commit
fdb6de4d23
7 files changed
+260
-40
No files matched your search
@@ -1 +1,39 @@
|
||||
"""Test fan component plaforms."""
|
||||
|
||||
import unittest
|
||||
|
||||
from homeassistant.components.fan import FanEntity
|
||||
|
||||
|
||||
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):
|
||||
"""Setup test data."""
|
||||
self.fan = BaseFan()
|
||||
|
||||
def tearDown(self):
|
||||
"""Tear down unit test data."""
|
||||
self.fan = None
|
||||
|
||||
def test_fanentity(self):
|
||||
"""Test fan entity methods."""
|
||||
self.assertIsNone(self.fan.state)
|
||||
self.assertEqual(0, len(self.fan.speed_list))
|
||||
self.assertEqual(0, self.fan.supported_features)
|
||||
self.assertEqual({}, self.fan.state_attributes)
|
||||
# Test set_speed not required
|
||||
self.fan.set_speed()
|
||||
self.fan.oscillate()
|
||||
with self.assertRaises(NotImplementedError):
|
||||
self.fan.turn_on()
|
||||
with self.assertRaises(NotImplementedError):
|
||||
self.fan.turn_off()
|
||||
Reference in new issue
Block a user