fix: only check inheritance of public attributes

This commit is contained in:
Mose Müller
2023-10-10 12:51:50 +02:00
parent 0b5dd5393a
commit 21cd039610
2 changed files with 20 additions and 3 deletions

View File

@ -2,7 +2,7 @@ from pytest import LogCaptureFixture
from pydase import DataService
from . import caplog # noqa
from .. import caplog # noqa
def test_setattr_warnings(caplog: LogCaptureFixture) -> None: # noqa
@ -32,3 +32,19 @@ def test_private_attribute_warning(caplog: LogCaptureFixture) -> None: # noqa
" Warning: You should not set private but rather protected attributes! Use "
"_something instead of __something." in caplog.text
)
def test_protected_attribute_warning(caplog: LogCaptureFixture) -> None: # noqa
class SubClass:
name = "Hello"
class ServiceClass(DataService):
def __init__(self) -> None:
self._subclass = SubClass
super().__init__()
ServiceClass()
assert (
"Warning: Class SubClass does not inherit from DataService." not in caplog.text
)