mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 04:13:16 +00:00
Add test for subtype.
This commit is contained in:
parent
40d4b8946b
commit
f1dd03fe80
1 changed files with 27 additions and 0 deletions
27
test/test_subtype.py
Normal file
27
test/test_subtype.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
from nose import main
|
||||
from nose.tools import *
|
||||
from msgpack import packb, unpackb
|
||||
from collections import namedtuple
|
||||
|
||||
class MyList(list):
|
||||
pass
|
||||
|
||||
class MyDict(dict):
|
||||
pass
|
||||
|
||||
class MyTuple(tuple):
|
||||
pass
|
||||
|
||||
MyNamedTuple = namedtuple('MyNamedTuple', 'x y')
|
||||
|
||||
def test_types():
|
||||
assert_equal(packb(dict()), packb(MyDict()))
|
||||
assert_equal(packb(list()), packb(MyList()))
|
||||
assert_equal(packb(MyNamedTuple(1,2)), packb((1,2)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue