Skip to content

Commit 0bb94e0

Browse files
committed
Re-formatted unit tests file
1 parent f8f900f commit 0bb94e0

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

tests/tests.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333

3434
# Standard library
3535
import logging
36-
import subprocess
37-
import unittest
3836
import os
37+
import subprocess
3938
import sys
39+
import unittest
4040

4141
# Prepare Python path to import javaobj
4242
sys.path.insert(0, os.path.abspath(os.path.dirname(os.getcwd())))
@@ -83,7 +83,9 @@ def read_file(self, filename, stream=False):
8383
:return: File content or stream
8484
"""
8585
for subfolder in ("java", ""):
86-
found_file = os.path.join(os.path.dirname(__file__), subfolder, filename)
86+
found_file = os.path.join(
87+
os.path.dirname(__file__), subfolder, filename
88+
)
8789
if os.path.exists(found_file):
8890
break
8991
else:
@@ -104,12 +106,18 @@ def _try_marshalling(self, original_stream, original_object):
104106
try:
105107
javaobj.loads(marshalled_stream)
106108
self.assertEqual(original_stream, marshalled_stream)
107-
except:
109+
except Exception:
108110
print("-" * 80)
109111
print("=" * 30, "Original", "=" * 30)
110-
print(javaobj.JavaObjectUnmarshaller._create_hexdump(original_stream))
112+
print(
113+
javaobj.JavaObjectUnmarshaller._create_hexdump(original_stream)
114+
)
111115
print("*" * 30, "Marshalled", "*" * 30)
112-
print(javaobj.JavaObjectUnmarshaller._create_hexdump(marshalled_stream))
116+
print(
117+
javaobj.JavaObjectUnmarshaller._create_hexdump(
118+
marshalled_stream
119+
)
120+
)
113121
print("-" * 80)
114122
raise
115123

@@ -288,14 +296,27 @@ def test_japan(self):
288296
pobj = javaobj.loads(jobj)
289297
_logger.debug(pobj)
290298
# Compare the UTF-8 encoded version of the name
291-
self.assertEqual(pobj, b"\xe6\x97\xa5\xe6\x9c\xac\xe5\x9b\xbd".decode("utf-8"))
299+
self.assertEqual(
300+
pobj, b"\xe6\x97\xa5\xe6\x9c\xac\xe5\x9b\xbd".decode("utf-8")
301+
)
292302
self._try_marshalling(jobj, pobj)
293303

294304
def test_char_array(self):
295305
jobj = self.read_file("testCharArray.ser")
296306
pobj = javaobj.loads(jobj)
297307
_logger.debug(pobj)
298-
self.assertEqual(pobj, [u'\u0000', u'\ud800', u'\u0001', u'\udc00', u'\u0002', u'\uffff', u'\u0003'])
308+
self.assertEqual(
309+
pobj,
310+
[
311+
u"\u0000",
312+
u"\ud800",
313+
u"\u0001",
314+
u"\udc00",
315+
u"\u0002",
316+
u"\uffff",
317+
u"\u0003",
318+
],
319+
)
299320
self._try_marshalling(jobj, pobj)
300321

301322
def test_enums(self):
@@ -417,6 +438,7 @@ def test_qistoph_pr_27(self):
417438
for key, value in pobj.items():
418439
self.assertEqual(parent_map[key], value)
419440

441+
420442
# ------------------------------------------------------------------------------
421443

422444

0 commit comments

Comments
 (0)