Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti committed Feb 11, 2023
1 parent b5c1d80 commit 51642bb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions miio/tests/test_devicestatus.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from enum import Enum

import pytest
Expand Down Expand Up @@ -321,7 +322,12 @@ def sensor_returning_none(self):
return None

status = Status()
assert (
status.__cli_output__
== "sensor_without_unit: 1\nsensor_with_unit: 2 V\n[RW] setting_without_unit: 3\n[RW] setting_with_unit: 4 V\n"
)
expected_regex = [
"sensor_without_unit (.+?): 1",
"sensor_with_unit (.+?): 2 V",
r"\[RW\] setting_without_unit (.+?): 3",
r"\[RW\] setting_with_unit (.+?): 4 V",
]

for idx, line in enumerate(status.__cli_output__.splitlines()):
assert re.match(expected_regex[idx], line) is not None

0 comments on commit 51642bb

Please sign in to comment.