Add missing unit for signal strength (#40436)

* Added missing unit for signal strength

* Added one more unit

* Replaced string with variable

* Fixed wrong import

* Fix import

* Replaced string with variable

* Fixed wrong import

* Apply suggestions from code review

* Black

* Again a fix :-(

* iSort

* iSort after merge

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
This commit is contained in:
Simone Chemelliandspringstan authored and GitHub committed 2020-10-01 16:14:29 +02:00
1 parent 480066ba63
commit 7554c8d6c5
15 files changed
+84 -27

No files matched your search

+9 -1
View File
@@ -3,11 +3,19 @@
import pytest
from homeassistant.components.huawei_lte import sensor
from homeassistant.const import (
SIGNAL_STRENGTH_DECIBELS,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
)
@pytest.mark.parametrize(
("value", "expected"),
(("-71 dBm", (-71, "dBm")), ("15dB", (15, "dB")), (">=-51dBm", (-51, "dBm"))),
(
("-71 dBm", (-71, SIGNAL_STRENGTH_DECIBELS_MILLIWATT)),
("15dB", (15, SIGNAL_STRENGTH_DECIBELS)),
(">=-51dBm", (-51, SIGNAL_STRENGTH_DECIBELS_MILLIWATT)),
),
)
def test_format_default(value, expected):
"""Test that default formatter copes with expected values."""