From 08136ac5b8b55f361d37df2a14ea386b48b1ad6c Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Tue, 9 Sep 2025 11:55:21 +0300 Subject: [PATCH] test: cover nested requirement matching --- tests/test_Lockable.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_Lockable.py b/tests/test_Lockable.py index 0aacd3d..c59b8b4 100644 --- a/tests/test_Lockable.py +++ b/tests/test_Lockable.py @@ -138,6 +138,15 @@ def test_parse_requirements(self): with self.assertRaises(ValueError): Lockable.parse_requirements('{\na=b}') + def test_lock_nested_requirement(self): + resources = [ + {"id": 1, "hostname": "myhost", "online": True, "my": {"field": "value"}} + ] + with create_lockable(resources) as lockable: + allocation = lockable.lock({"my.field": "value"}, timeout_s=0) + self.assertEqual(allocation.resource_info["id"], 1) + allocation.release(allocation.alloc_id) + def test_lock_resource_not_found(self): with create_lockable([]) as lockable: with self.assertRaises(ResourceNotFound):