瀏覽代碼

test (sensor): adapt to new default suggested_display_precision

Jason Rumney 2 月之前
父節點
當前提交
d6741677a1
共有 1 個文件被更改,包括 17 次插入1 次删除
  1. 17 1
      tests/test_sensor.py

+ 17 - 1
tests/test_sensor.py

@@ -114,4 +114,20 @@ def test_sensor_suggested_display_precision():
         },
     )
     sensor = TuyaLocalSensor(mock_device, config)
-    assert sensor.suggested_display_precision is None
+    assert sensor.suggested_display_precision == 0
+    config = TuyaEntityConfig(
+        mock_device,
+        {
+            "entity": "sensor",
+            "dps": [
+                {
+                    "id": 1,
+                    "name": "sensor",
+                    "type": "integer",
+                    "mapping": [{"scale: 10"}],
+                },
+            ],
+        },
+    )
+    sensor = TuyaLocalSensor(mock_device, config)
+    assert sensor.suggested_display_precision == 1