Skip to content

Commit e98271f

Browse files
authored
Merge pull request #189 from xeroc/release/20231123
fix: allow maps to contain dicts
2 parents 4173f45 + 341c17f commit e98271f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

graphenebase/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def __bytes__(self):
325325
def __str__(self):
326326
r = []
327327
for e in self.data:
328-
r.append([str(e[0]), str(e[1])])
328+
r.append([str(e[0]), JsonObj(str(e[1]))])
329329
return json.dumps(r)
330330

331331

tests/test_types.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,35 +228,35 @@ def test_uint8(self):
228228
self.assertEqual(str(u), "10")
229229

230230
def test_uint16(self):
231-
u = types.Uint16(2 ** 16 - 1)
231+
u = types.Uint16(2**16 - 1)
232232
self.assertEqual(bytes(u), b"\xff\xff")
233-
self.assertEqual(str(u), str(2 ** 16 - 1))
233+
self.assertEqual(str(u), str(2**16 - 1))
234234

235235
def test_uint32(self):
236-
u = types.Uint32(2 ** 32 - 1)
236+
u = types.Uint32(2**32 - 1)
237237
self.assertEqual(bytes(u), b"\xff\xff\xff\xff")
238-
self.assertEqual(str(u), str(2 ** 32 - 1))
238+
self.assertEqual(str(u), str(2**32 - 1))
239239

240240
def test_uint64(self):
241-
u = types.Uint64(2 ** 64 - 1)
241+
u = types.Uint64(2**64 - 1)
242242
self.assertEqual(bytes(u), b"\xff\xff\xff\xff\xff\xff\xff\xff")
243-
self.assertEqual(str(u), str(2 ** 64 - 1))
243+
self.assertEqual(str(u), str(2**64 - 1))
244244

245245
def test_int64(self):
246-
u = types.Int64(2 ** 63 - 1)
246+
u = types.Int64(2**63 - 1)
247247
self.assertEqual(bytes(u), b"\xff\xff\xff\xff\xff\xff\xff\x7f")
248248
self.assertEqual(str(u), str(9223372036854775807))
249249

250250
def test_int16(self):
251-
u = types.Int16(2 ** 15 - 1)
251+
u = types.Int16(2**15 - 1)
252252
self.assertEqual(bytes(u), b"\xff\x7f")
253-
self.assertEqual(str(u), str(2 ** 15 - 1))
253+
self.assertEqual(str(u), str(2**15 - 1))
254254

255255
def test_varint32(self):
256-
u = types.Varint32(2 ** 32 - 1)
256+
u = types.Varint32(2**32 - 1)
257257
self.assertEqual(bytes(u), b"\xff\xff\xff\xff\x0f")
258258
self.assertEqual(str(u), str(4294967295))
259-
u = types.Id(2 ** 32 - 1)
259+
u = types.Id(2**32 - 1)
260260
self.assertEqual(bytes(u), b"\xff\xff\xff\xff\x0f")
261261
self.assertEqual(str(u), str(4294967295))
262262

@@ -338,7 +338,7 @@ def json(self):
338338
def test_Map(self):
339339
u = types.Map([[types.Uint16(10), types.Uint16(11)]])
340340
self.assertEqual(bytes(u), b"\x01\n\x00\x0b\x00")
341-
self.assertEqual(str(u), '[["10", "11"]]')
341+
self.assertEqual(str(u), '[["10", 11]]')
342342

343343
def test_voteid(self):
344344
u = types.VoteId("0:30")

0 commit comments

Comments
 (0)