From 108dc175504f0d40ad6e35330916ee85083eac1f Mon Sep 17 00:00:00 2001 From: Balazs Bohar Date: Tue, 17 Sep 2024 13:47:07 +0100 Subject: [PATCH] Write to test updating namespaces --- tests/test_attr_update.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_attr_update.py b/tests/test_attr_update.py index b662388..ce36d78 100644 --- a/tests/test_attr_update.py +++ b/tests/test_attr_update.py @@ -9,3 +9,29 @@ def test_attr_update_new(test_cache): it1 = test_cache.search('testattrupdate')[0] assert it1.attrs == {**attrs0, **attrs1} + + +def test_update_attr_namespaces(test_cache): + + attrs0 = { + 'foo': 'bar', + 'attrdict': { + 'numbers': [0, 1, 2, 3, 4] + } + } + + it = test_cache.best_or_new('updatenamespace', attrs = attrs0) + it1 = test_cache.search('updatenamespace')[0] + + assert it1.attrs == attrs0 + + attrs1 = { + 'foo': 'bar', + 'attrdict': { + 'numbers': [5, 6, 7, 8] + } + } + test_cache.update(it.uri, update = {'attrs': attrs1}) + it2 = test_cache.search('updatenamespace')[0] + + assert it2.attrs == attrs1