Skip to content

Commit

Permalink
Add test for the natural speed setter
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jun 4, 2018
1 parent b5738af commit 01fdc68
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions miio/tests/test_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,23 @@ def direct_speed():
with pytest.raises(FanException):
self.device.set_direct_speed(101)

def test_set_natural_speed(self):
def natural_speed():
return self.device.status().natural_speed

self.device.set_natural_speed(0)
assert natural_speed() == 0
self.device.set_natural_speed(1)
assert natural_speed() == 1
self.device.set_natural_speed(100)
assert natural_speed() == 100

with pytest.raises(FanException):
self.device.set_natural_speed(-1)

with pytest.raises(FanException):
self.device.set_natural_speed(101)

def test_set_rotate(self):
"""The method is open-loop. The new state cannot be retrieved."""
self.device.set_rotate(MoveDirection.Left)
Expand Down

0 comments on commit 01fdc68

Please sign in to comment.