Skip to content

Commit

Permalink
Add test to check failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdwetering committed Aug 5, 2024
1 parent 426353c commit b02df03
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/test_subunit.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
"""Test Zone subunit"""

from unittest import mock
from unittest.mock import create_autospec
import pytest

from ynca import Avail
from ynca.constants import Subunit
from ynca.subunit import SubunitBase
from ynca.function import IntFunctionMixin
from ynca.errors import YncaInitializationFailedException
from ynca.subunits.system import System


SYS = "SYS"
Expand Down Expand Up @@ -140,7 +142,21 @@ def test_status_not_ok_ignored(


def test_write_function_calls_connection_put(
connection, initialized_dummysubunit: SubunitBase, update_callback
connection, initialized_dummysubunit: DummySubunit, update_callback
):
initialized_dummysubunit.dummy_function = 123
connection.put.assert_called_with("UAW", "DUMMY_FUNCTION", "123")

def test_unreadable_attributes_ignored(connection):
'''
This test is specifically to check handling of unreadable attributes
as found with issue https://github.com/mvdwetering/yamaha_ynca/issues/315
'''

class descriptor:
def __get__(self, instance, owner):
raise AttributeError("unreadable attribute")

DummySubunit.__provides__ = descriptor()
DummySubunit(connection)

0 comments on commit b02df03

Please sign in to comment.