Skip to content

Commit be07359

Browse files
committed
test(service): cover decorator-signature validation error paths
1 parent 4ade218 commit be07359

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/service/test_decorator_signatures.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,30 @@ def test_signature_must_be_string():
113113
dbus_property(signature=5)
114114

115115

116+
def test_method_without_signature_requires_annotations():
117+
def no_annotation(self, value) -> None:
118+
return None
119+
120+
with pytest.raises(ValueError, match="method parameters must specify"):
121+
dbus_method()(no_annotation)
122+
123+
124+
def test_property_signature_must_be_single_complete_type():
125+
def getter(self) -> int:
126+
return 0
127+
128+
with pytest.raises(ValueError, match="single complete type"):
129+
dbus_property(signature="ss")(getter)
130+
131+
132+
def test_property_without_signature_requires_return_annotation():
133+
def getter(self):
134+
return 0
135+
136+
with pytest.raises(ValueError, match="return annotation"):
137+
dbus_property()(getter)
138+
139+
116140
@pytest.mark.asyncio
117141
async def test_decorator_signature_round_trip():
118142
bus1 = await MessageBus().connect()

0 commit comments

Comments
 (0)