From b9a2f52d785b75945a47ce3cb85605cf85fc3007 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 1 May 2023 13:57:47 -0400 Subject: [PATCH] Exercise another path with deterministic tests Signed-off-by: mulhern --- tests/test_deterministic.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_deterministic.py b/tests/test_deterministic.py index 8b5d96e..73e32a1 100644 --- a/tests/test_deterministic.py +++ b/tests/test_deterministic.py @@ -12,7 +12,10 @@ # isort: LOCAL from dbus_client_gen import GMOQuery, managed_object_class, mo_query_builder -from dbus_client_gen._errors import DbusClientGenerationError +from dbus_client_gen._errors import ( + DbusClientGenerationError, + DbusClientUniqueResultError, +) class DeterministicTestCase(unittest.TestCase): @@ -45,3 +48,12 @@ def test_unique_match(self): self.assertEqual(len(search_result), 1) self.assertEqual(search_result[0], test_item) + + def test_unique_match_failure(self): + """ + Fail to get the unique match because no match criterion provided. + """ + with self.assertRaises(DbusClientUniqueResultError): + GMOQuery( + "interface_name", {"prop_name": "prop_value"} + ).require_unique_match().search({})