import pytest

from matterlab_relays import Relay


class MockRelay(Relay):
    def __init__(self):
        super().__init__()
        self._on = False

    @property
    def on(self) -> bool:
        return self._on

    @on.setter
    def on(self, state: bool) -> None:
        self._on = state


def test_relay_abstract_methods():
    with pytest.raises(TypeError):
        Relay()


def test_mock_relay_instantiation():
    relay = MockRelay()
    assert isinstance(relay, Relay)


def test_mock_relay_state_changes():
    relay = MockRelay()
    assert relay.on is False
    relay.on = True
    assert relay.on is True
