registry.Json: Fix broken test due to returning the internal state directly

This commit is contained in:
Valentin Lorentz 2025-04-06 10:19:17 +02:00
parent c795cdc655
commit c81ff28697
2 changed files with 6 additions and 3 deletions

View File

@ -31,6 +31,7 @@
import re
import os
import copy
import time
import json
import codecs
@ -921,6 +922,8 @@ class TemplatedString(String):
class Json(String):
__slots__ = ()
def __call__(self):
return copy.deepcopy(super(Json, self).__call__())
def set(self, v):
self.setValue(json.loads(v))
def __str__(self):

View File

@ -140,13 +140,13 @@ class ValuesTestCase(SupyTestCase):
self.assertIsNot(v(), data)
with v.editable() as dict_:
dict_['supy'] = 'bot'
dict_['supy'] = ['bot']
del dict_['qux']
self.assertNotIn('supy', v())
self.assertIn('qux', v())
self.assertIn('supy', v())
self.assertEqual(v()['supy'], 'bot')
self.assertIsNot(v()['supy'], 'bot')
self.assertEqual(v()['supy'], ['bot'])
self.assertIsNot(v()['supy'], ['bot'])
self.assertNotIn('qux', v())
def testNormalizedString(self):