Skip to content

Commit c1adf39

Browse files
committed
Add except for PlugwiseException
1 parent 2432913 commit c1adf39

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_smile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ async def tinker_thermostat_temp(self, smile, loc_id, unhappy=False):
496496
raise self.UnexpectedError
497497

498498
@pytest.mark.asyncio
499-
async def tinker_thermostat_preset(self, smile, loc_id):
499+
async def tinker_thermostat_preset(self, smile, loc_id, unhappy=False):
500500
"""Toggle preset to test functionality."""
501501
for new_preset in ["asleep", "home", "!bogus"]:
502502
warning = ""
@@ -507,11 +507,13 @@ async def tinker_thermostat_preset(self, smile, loc_id):
507507
try:
508508
await smile.set_preset(loc_id, new_preset)
509509
_LOGGER.info(" + worked as intended")
510+
except pw_exceptions.PlugwiseException:
511+
_LOGGER.info(" + failed as expected")
510512
except (
511513
pw_exceptions.ErrorSendingCommandError,
512514
pw_exceptions.ResponseError,
513515
):
514-
if new_preset[0] == "!":
516+
if unhappy:
515517
_LOGGER.info(" + failed as expected")
516518
else: # pragma: no cover
517519
_LOGGER.info(" - failed unexpectedly")

0 commit comments

Comments
 (0)