mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-08 05:21:01 +00:00
Support object_pairs_hook
Merge remote-tracking branch 'jnothman/object_pairs_hook' into 0.2-maint Conflicts: msgpack/_msgpack.pyx test/test_pack.py test/test_sequnpack.py
This commit is contained in:
commit
e381032641
7 changed files with 143 additions and 90 deletions
|
|
@ -110,10 +110,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), use_list=1), 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