Skip to content

Commit

Permalink
Fixing: RuntimeError: generator raised StopIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Jul 22, 2020
1 parent 78245b1 commit a02f298
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pdfrw/pdfwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def format_obj(obj):
if compress and obj.stream:
do_compress([obj])
pairs = sorted((getattr(x, 'encoded', None) or x, y)
for (x, y) in obj.iteritems())
for (x, y) in iteritems(obj))
myarray = []
for key, value in pairs:
myarray.append(key)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def do_test(self, params, prev_results=[''], scrub=False):
os.remove(dstf)
if scrub and os.path.exists(scrub):
os.remove(scrub)
subprocess.call(params)
subprocess.check_output(params)
if scrub:
PdfWriter(dstf).addpages(PdfReader(scrub).pages).write()
with open(dstf, 'rb') as f:
Expand All @@ -109,7 +109,7 @@ def do_test(self, params, prev_results=[''], scrub=False):
if expects:
if len(expects) == 1:
expects, = expects
self.assertEqual(hash, expects)
self.assertEqual(hash, expects, '{} file does not have the expected MD5 hash'.format(dstf))
else:
self.assertIn(hash, expects)
result = 'pass'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def roundtrip(self, testname, basename, srcf, decompress=False,
if expects:
if len(expects) == 1:
expects, = expects
self.assertEqual(hash, expects)
self.assertEqual(hash, expects, '{} file does not have the expected MD5 hash'.format(dstf))
else:
self.assertIn(hash, expects)
result = 'pass'
Expand Down

0 comments on commit a02f298

Please sign in to comment.