summaryrefslogtreecommitdiff
path: root/test/test_unpack.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-12-05 18:51:45 +0900
committerInada Naoki <songofacandy@gmail.com>2019-12-05 18:51:45 +0900
commit10e5e39ff9739fa3ce589ad9d451260be0f3842c (patch)
tree0d23443fd722d1e6279880f8a5d8c739902e96f7 /test/test_unpack.py
parente557e17cbd4e88622e48547ac52834e9ab95f946 (diff)
downloadmsgpack-python-10e5e39ff9739fa3ce589ad9d451260be0f3842c.tar.gz
blacken test
Diffstat (limited to 'test/test_unpack.py')
-rw-r--r--test/test_unpack.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/test/test_unpack.py b/test/test_unpack.py
index 00a1061..bc74c4d 100644
--- a/test/test_unpack.py
+++ b/test/test_unpack.py
@@ -5,7 +5,7 @@ from pytest import raises, mark
def test_unpack_array_header_from_file():
- f = BytesIO(packb([1,2,3,4]))
+ f = BytesIO(packb([1, 2, 3, 4]))
unpacker = Unpacker(f)
assert unpacker.read_array_header() == 4
assert unpacker.unpack() == 1
@@ -16,8 +16,10 @@ def test_unpack_array_header_from_file():
unpacker.unpack()
-@mark.skipif("not hasattr(sys, 'getrefcount') == True",
- reason='sys.getrefcount() is needed to pass this test')
+@mark.skipif(
+ "not hasattr(sys, 'getrefcount') == True",
+ reason="sys.getrefcount() is needed to pass this test",
+)
def test_unpacker_hook_refcnt():
result = []
@@ -43,12 +45,9 @@ def test_unpacker_hook_refcnt():
def test_unpacker_ext_hook():
-
class MyUnpacker(Unpacker):
-
def __init__(self):
- super(MyUnpacker, self).__init__(
- ext_hook=self._hook, raw=False)
+ super(MyUnpacker, self).__init__(ext_hook=self._hook, raw=False)
def _hook(self, code, data):
if code == 1:
@@ -57,15 +56,15 @@ def test_unpacker_ext_hook():
return ExtType(code, data)
unpacker = MyUnpacker()
- unpacker.feed(packb({'a': 1}))
- assert unpacker.unpack() == {'a': 1}
- unpacker.feed(packb({'a': ExtType(1, b'123')}))
- assert unpacker.unpack() == {'a': 123}
- unpacker.feed(packb({'a': ExtType(2, b'321')}))
- assert unpacker.unpack() == {'a': ExtType(2, b'321')}
+ unpacker.feed(packb({"a": 1}))
+ assert unpacker.unpack() == {"a": 1}
+ unpacker.feed(packb({"a": ExtType(1, b"123")}))
+ assert unpacker.unpack() == {"a": 123}
+ unpacker.feed(packb({"a": ExtType(2, b"321")}))
+ assert unpacker.unpack() == {"a": ExtType(2, b"321")}
-if __name__ == '__main__':
+if __name__ == "__main__":
test_unpack_array_header_from_file()
test_unpacker_hook_refcnt()
test_unpacker_ext_hook()