diff --git a/pdfrw/pdfwriter.py b/pdfrw/pdfwriter.py index 789527c..cb884cb 100755 --- a/pdfrw/pdfwriter.py +++ b/pdfrw/pdfwriter.py @@ -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) diff --git a/tests/test_examples.py b/tests/test_examples.py index 6871b80..aac2d00 100755 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -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: @@ -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' diff --git a/tests/test_roundtrip.py b/tests/test_roundtrip.py index 2e097b6..62bdcc9 100755 --- a/tests/test_roundtrip.py +++ b/tests/test_roundtrip.py @@ -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'