mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00

The following steps have been taken: 1. Black was updated to latest version. The code has been formatted with the new version. 2. The pyupgrade utility is installed. This helped to remove all the code that was needed to support Python < 3.7. Fix #541. Co-authored-by: Inada Naoki <songofacandy@gmail.com>
25 lines
401 B
Python
25 lines
401 B
Python
#!/usr/bin/env python
|
|
|
|
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 packb(MyDict()) == packb(dict())
|
|
assert packb(MyList()) == packb(list())
|
|
assert packb(MyNamedTuple(1, 2)) == packb((1, 2))
|