mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00
Implement object_pairs_hook
This commit is contained in:
parent
b06ed8eb75
commit
77942514db
5 changed files with 61 additions and 22 deletions
|
@ -111,10 +111,9 @@ def test_odict():
|
|||
seq = [(b'one', 1), (b'two', 2), (b'three', 3), (b'four', 4)]
|
||||
od = odict(seq)
|
||||
assert_equal(unpackb(packb(od)), dict(seq))
|
||||
# After object_pairs_hook is implemented.
|
||||
#def pair_hook(seq):
|
||||
# return seq
|
||||
#assert_equal(unpackb(packb(od), object_pairs_hook=pair_hook), seq)
|
||||
def pair_hook(seq):
|
||||
return seq
|
||||
assert_equal(unpackb(packb(od), object_pairs_hook=pair_hook), seq)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue