mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-02-05 00:07:38 -08:00
36 lines
1.4 KiB
Diff
36 lines
1.4 KiB
Diff
From 6b46d03ee3a5bd5c2c18fae8aec8a0020ee68add Mon Sep 17 00:00:00 2001
|
|
From: Venelin Stoykov <vkstoykov@gmail.com>
|
|
Date: Sat, 26 Dec 2015 17:26:00 +0200
|
|
Subject: [PATCH 2/3] Fix tests for Python 3
|
|
|
|
---
|
|
Tests/tests.py | 11 ++++++-----
|
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/Tests/tests.py b/Tests/tests.py
|
|
index fa93c10..83b5951 100644
|
|
--- a/Tests/tests.py
|
|
+++ b/Tests/tests.py
|
|
@@ -27,14 +27,15 @@ def test_PdfReaderFileLoad(self):
|
|
ipdf_p1 = ipdf.getPage(0)
|
|
|
|
# Retrieve the text of the PDF
|
|
- pdftext_file = open(os.path.join(RESOURCE_ROOT, 'crazyones.txt'), 'r')
|
|
- pdftext = pdftext_file.read()
|
|
- ipdf_p1_text = ipdf_p1.extractText().replace('\n', '')
|
|
+ with open(os.path.join(RESOURCE_ROOT, 'crazyones.txt'), 'rb') as pdftext_file:
|
|
+ pdftext = pdftext_file.read()
|
|
+
|
|
+ ipdf_p1_text = ipdf_p1.extractText().replace('\n', '').encode('utf-8')
|
|
|
|
# Compare the text of the PDF to a known source
|
|
- self.assertEqual(ipdf_p1_text.encode('utf-8', errors='ignore'), pdftext,
|
|
+ self.assertEqual(ipdf_p1_text, pdftext,
|
|
msg='PDF extracted text differs from expected value.\n\nExpected:\n\n%r\n\nExtracted:\n\n%r\n\n'
|
|
- % (pdftext, ipdf_p1_text.encode('utf-8', errors='ignore')))
|
|
+ % (pdftext, ipdf_p1_text))
|
|
|
|
|
|
class AddJsTestCase(unittest.TestCase):
|
|
|