Skip to content

Commit c81ff28

Browse files
committed
registry.Json: Fix broken test due to returning the internal state directly
1 parent c795cdc commit c81ff28

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: src/registry.py

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import re
3333
import os
34+
import copy
3435
import time
3536
import json
3637
import codecs
@@ -921,6 +922,8 @@ def hasTemplate(s):
921922
class Json(String):
922923
__slots__ = ()
923924

925+
def __call__(self):
926+
return copy.deepcopy(super(Json, self).__call__())
924927
def set(self, v):
925928
self.setValue(json.loads(v))
926929
def __str__(self):

Diff for: test/test_registry.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ def testJson(self):
140140
self.assertIsNot(v(), data)
141141

142142
with v.editable() as dict_:
143-
dict_['supy'] = 'bot'
143+
dict_['supy'] = ['bot']
144144
del dict_['qux']
145145
self.assertNotIn('supy', v())
146146
self.assertIn('qux', v())
147147
self.assertIn('supy', v())
148-
self.assertEqual(v()['supy'], 'bot')
149-
self.assertIsNot(v()['supy'], 'bot')
148+
self.assertEqual(v()['supy'], ['bot'])
149+
self.assertIsNot(v()['supy'], ['bot'])
150150
self.assertNotIn('qux', v())
151151

152152
def testNormalizedString(self):

0 commit comments

Comments
 (0)