Skip to content

Commit

Permalink
test: Add a test that methods properly return None
Browse files Browse the repository at this point in the history
Some error in implementation might make methods return something
other than None when they supposed to.
  • Loading branch information
igo95862 committed Feb 11, 2024
1 parent e7f3bb1 commit c0b2965
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_sdbus_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ async def looong_method(self) -> None:
def empty_signal(self) -> None:
raise NotImplementedError

@dbus_method_async()
async def returns_none_method(self) -> None:
return


class DbusErrorTest(DbusFailedError):
dbus_error_name = 'org.example.Error'
Expand Down Expand Up @@ -310,6 +314,17 @@ async def test_method(self) -> None:

self.assertTrue(await test_object_connection.get_sender())

with self.subTest("Test method that returns None"):
self.assertIsNone(

await test_object
.returns_none_method() # type: ignore[func-returns-value]
)
self.assertIsNone(
await test_object_connection
.returns_none_method() # type: ignore[func-returns-value]
)

async def test_subclass(self) -> None:
test_object, test_object_connection = initialize_object()

Expand Down

0 comments on commit c0b2965

Please sign in to comment.