Skip to content

Commit 015ab6a

Browse files
committed
Add an addition test for empty dictionaries
Signed-off-by: mulhern <amulhern@redhat.com>
1 parent 38d56ff commit 015ab6a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_hypothesis.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,28 @@ class ParseTestCase(unittest.TestCase):
155155
Test parsing various signatures.
156156
"""
157157

158+
@given(
159+
strategies.tuples(
160+
dbus_signatures(
161+
min_complete_types=1,
162+
max_complete_types=1,
163+
exclude_arrays=True,
164+
exclude_dicts=True,
165+
exclude_structs=True,
166+
blacklist="v",
167+
),
168+
dbus_signatures(min_complete_types=1, max_complete_types=1),
169+
)
170+
)
171+
@settings(max_examples=5)
172+
def test_empty_dict(self, strat):
173+
"""
174+
Test parsing an empty dict with a valid signature.
175+
"""
176+
(key_sig, value_sig) = strat
177+
sig = f"{key_sig}{value_sig}"
178+
self.assertEqual(signature(dbus.Dictionary(signature=sig)), "a{" + sig + "}")
179+
158180
@given(
159181
dbus_signatures(
160182
min_complete_types=1, max_complete_types=1, blacklist="h"

0 commit comments

Comments
 (0)