Skip to content

Commit

Permalink
Some unit tests for edge cases added.
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Nov 26, 2017
1 parent 85b0f10 commit e5c83c3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions miio/tests/test_airpurifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def test_set_led(self):
def led():
return self.device.status().led

# The LED brightness of a Air Purifier Pro cannot be set so far.
self.device.set_led(True)
assert led() == True

Expand All @@ -157,3 +158,29 @@ def child_lock():

self.device.set_child_lock(False)
assert child_lock() == False

def test_status_without_led_b_and_with_bright(self):
self.device._reset_state()

self.device.state["bright"] = self.device.state["led_b"]
del self.device.state["led_b"]

assert self.state().led_brightness == LedBrightness(self.device.start_state["led_b"])

def test_status_without_led_brightness_at_all(self):
self.device._reset_state()

self.device.state["led_b"] = None
self.device.state["bright"] = None
assert self.state().led_brightness is None

def test_status_without_temperature(self):
self.device._reset_state()
self.device.state["temp_dec"] = None

assert self.state().temperature is None

def test_status_string(self):
self.device._reset_state()

assert self.state().__str__

0 comments on commit e5c83c3

Please sign in to comment.