diff options
author | INADA Naoki <inada-n@klab.com> | 2012-12-10 21:26:41 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2012-12-10 21:26:41 +0900 |
commit | 537a2ab3f262d65f5a85741ddbb4ac6604ed7e0b (patch) | |
tree | 8834c8799863c97c70060e582e9d2f36035c32b8 /test | |
parent | 0c7ab7c3441e96b33fa7bca8fcaa10d3087aba2a (diff) | |
download | msgpack-python-537a2ab3f262d65f5a85741ddbb4ac6604ed7e0b.tar.gz |
Add `Packer.pack_pairs`.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_pack.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/test_pack.py b/test/test_pack.py index 21c2bd7..b918f8e 100644 --- a/test/test_pack.py +++ b/test/test_pack.py @@ -118,8 +118,6 @@ def testMapSize(sizes=[0, 5, 50, 1000]): assert unpacker.unpack() == dict((i, i * 2) for i in range(size)) - - class odict(dict): '''Reimplement OrderedDict to run test on Python 2.6''' def __init__(self, seq): @@ -144,5 +142,14 @@ def test_odict(): assert_equal(unpackb(packb(od), object_pairs_hook=pair_hook, use_list=1), seq) +def test_pairlist(): + pairlist = [(b'a', 1), (2, b'b'), (b'foo', b'bar')] + packer = Packer() + packed = packer.pack_map_pairs(pairlist) + unpacked = unpackb(packed, object_pairs_hook=list) + assert pairlist == unpacked + + + if __name__ == '__main__': main() |