Bläddra i källkod

Events: unit test and formatting changes.

Fix black issues and unit test breakage.
Jason Rumney 2 år sedan
förälder
incheckning
c668062a1a

+ 1 - 1
custom_components/tuya_local/event.py

@@ -35,7 +35,7 @@ class TuyaLocalEvent(TuyaLocalEntity, EventEntity):
         self._event_dp = dps_map.pop("event")
         self._init_end(dps_map)
 
-        # Set up device_class via parent class attribute 
+        # Set up device_class via parent class attribute
         try:
             self._attr_device_class = EventDeviceClass(self._config.device_class)
         except ValueError:

+ 1 - 0
custom_components/tuya_local/helpers/mixin.py

@@ -109,6 +109,7 @@ class TuyaLocalEntity:
         """Override to process dps directly as they are received"""
         pass
 
+
 UNIT_ASCII_MAP = {
     "C": UnitOfTemperature.CELSIUS,
     "F": UnitOfTemperature.FAHRENHEIT,

+ 2 - 0
tests/devices/base_device_tests.py

@@ -10,6 +10,7 @@ from custom_components.tuya_local.button import TuyaLocalButton
 from custom_components.tuya_local.camera import TuyaLocalCamera
 from custom_components.tuya_local.climate import TuyaLocalClimate
 from custom_components.tuya_local.cover import TuyaLocalCover
+from custom_components.tuya_local.event import TuyaLocalEvent
 from custom_components.tuya_local.fan import TuyaLocalFan
 from custom_components.tuya_local.helpers.device_config import (
     TuyaDeviceConfig,
@@ -35,6 +36,7 @@ DEVICE_TYPES = {
     "camera": TuyaLocalCamera,
     "climate": TuyaLocalClimate,
     "cover": TuyaLocalCover,
+    "event": TuyaLocalEvent,
     "fan": TuyaLocalFan,
     "humidifier": TuyaLocalHumidifier,
     "lawn_mower": TuyaLocalLawnMower,

+ 1 - 0
tests/test_device_config.py

@@ -62,6 +62,7 @@ KNOWN_DPS = {
             "reversed",
         ],
     },
+    "event": {"required": ["event"], "optional": []},
     "fan": {
         "required": [{"or": ["preset_mode", "speed"]}],
         "optional": ["switch", "oscillate", "direction"],

+ 1 - 3
tests/test_event.py

@@ -35,9 +35,7 @@ async def test_init_entry(hass):
     }
 
     await async_setup_entry(hass, entry, m_add_entities)
-    assert (
-        type(hass.data[DOMAIN]["dummy"]["event_button_1"]) == TuyaLocalEvent
-    )
+    assert type(hass.data[DOMAIN]["dummy"]["event_button_1"]) == TuyaLocalEvent
     m_add_entities.assert_called_once()