Skip to content

Commit dbf361a

Browse files
committed
Align test expectations with dependencies update
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 72a9251 commit dbf361a

File tree

3 files changed

+145
-10
lines changed

3 files changed

+145
-10
lines changed

tests/formattedcode/test_output_templated.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ def test_custom_format_with_custom_filename_fails_for_directory():
109109
result_file = test_env.get_temp_file('html')
110110
args = ['--info', '--custom-template', test_dir, '--custom-output', result_file, test_dir]
111111
result = run_scan_click(args, expected_rc=2)
112-
assert 'Invalid value for "--custom-template": Path' in result.output
112+
assert 'Invalid value for "--custom-template":' in normalize_quotes(result.output)
113+
114+
def normalize_quotes(s):
115+
return s.replace("'", '"')
113116

114117

115118
@pytest.mark.scanslow

tests/licensedcode/test_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ def test_query_run_for_text_with_long_lines(self):
774774
assert len(Query(location1, idx=idx).query_runs) == 17
775775
assert len(Query(location2, idx=idx).query_runs) == 15
776776

777-
@expectedFailure
778777
def test_Query_tokens_by_line_behaves_the_same_on_various_python_2(self):
779778
location = self.get_test_loc('query/query_lines/yahoo-eula.txt')
780779
idx = cache.get_index()

tests/textcode/test_pdf.py

Lines changed: 141 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,11 @@ def test_get_text_lines_can_parse_faulty_broadcom_doc(self):
7979

8080
def test_pdfminer_can_parse_apache_fop_test_pdf(self):
8181
test_file = self.get_test_loc('pdf/fop_test_pdf_1.5_test.pdf')
82-
from pdfminer.pdfparser import PDFParser
83-
from pdfminer.pdfdocument import PDFDocument
84-
with open(test_file, 'rb') as inputfile:
85-
parser = PDFParser(inputfile)
86-
PDFDocument(parser)
87-
8882
result = pdf.get_text_lines(test_file)
89-
expected = apache_fop_expected
90-
assert result == expected
83+
try:
84+
assert result == apache_fop_expected
85+
except AssertionError:
86+
assert result == apache_fop_expected_2020
9187

9288
def test_numbered_text_lines_does_not_fail_on_autocad_test_pdf(self):
9389
test_file = self.get_test_loc('pdf/AutoCad_Diagram.pdf')
@@ -221,3 +217,140 @@ def test_numbered_text_lines_does_not_fail_on_autocad_test_pdf(self):
221217
b'\n',
222218
b'\x0c'
223219
]
220+
221+
apache_fop_expected_2020 = [
222+
b'This is the page header\n',
223+
b'\n',
224+
b'(There\xe2\x80\x99s another page se-\n',
225+
b'quence below.)\n',
226+
b'\n',
227+
b'About Apache FOP\n',
228+
b'It is a print formatter driv-\n',
229+
b'en by XSL formatting ob-\n',
230+
b'jects (XSL-FO) and an out-\n',
231+
b'format-\n',
232+
b'put \n',
233+
b'\n',
234+
b'independent \n',
235+
b'\n',
236+
b'Page 1\n',
237+
b'ter1. FOP has a nice logo:\n',
238+
b'\n',
239+
b'Header 1.1 Header 1.2\n',
240+
b'\n',
241+
b'Cell 1.1\n',
242+
b'\n',
243+
b'Cell 1.2\n',
244+
b'\n',
245+
b'See the FOP website for more information\n',
246+
b'\n',
247+
b'\x0cThis is the page header\n',
248+
b'\n',
249+
b'Page 2\n',
250+
b'\n',
251+
b'Cell 2.2\n',
252+
b'\n',
253+
b'Cell 2.1\n',
254+
b'\n',
255+
b'Header 1.1 Header 1.2\n',
256+
b'\n',
257+
b'(XSL-FO) and an output in-\n',
258+
b'dependent formatter. It is a\n',
259+
b'Java application that reads\n',
260+
b'a formatting object (FO)\n',
261+
b'tree and renders the res-\n',
262+
b'ulting pages to a specified\n',
263+
b'output.\n',
264+
b'\n',
265+
b'Apache FOP (Formatting\n',
266+
b'Objects Processor) is a\n',
267+
b'print formatter driven by\n',
268+
b'XSL \n',
269+
b'formatting objects\n',
270+
b'This fo:block element spans all the columns of the docu-\n',
271+
b'ment. This is intended to test the abilities of the text-to-\n',
272+
b'speech program.\n',
273+
b'And now we are back to\n',
274+
b'normal content flowing in\n',
275+
b'\n',
276+
b'\x0cPage 3\n',
277+
b'\n',
278+
b'This is the page header\n',
279+
b'\n',
280+
b'two columns. Let\xe2\x80\x99s start a\n',
281+
b'numbered list:\n',
282+
b'1. Line 1 of item 1\n',
283+
b'Line 2 of item 1\n',
284+
b'Line 3 of item 1\n',
285+
b'2. Line 1 of item 2\n',
286+
b'Line 2 of item 2\n',
287+
b'Line 3 of item 2\n',
288+
b'\n',
289+
b'And now we are going to\n',
290+
b'see how a second page\n',
291+
b'sequence is handled.\n',
292+
b'\n',
293+
b'\x0cThis is the page header\n',
294+
b'\n',
295+
b'Apache FOP (Formatting\n',
296+
b'Objects Processor) is a\n',
297+
b'print formatter driven by\n',
298+
b'XSL \n',
299+
b'formatting objects\n',
300+
b'(XSL-FO) and an output\n',
301+
b'independent formatter1. It\n',
302+
b'is a Java application that\n',
303+
b'reads a formatting object\n',
304+
b'(FO) tree and renders the\n',
305+
b'\n',
306+
b'Page 4\n',
307+
b'\n',
308+
b'resulting pages to a spe-\n',
309+
b'cified output.\n',
310+
b'\n',
311+
b'Header 1.1 Header 1.2\n',
312+
b'\n',
313+
b'Cell 1.1\n',
314+
b'Cell 2.1\n',
315+
b'\n',
316+
b'Cell 1.2\n',
317+
b'Cell 2.2\n',
318+
b'\n',
319+
b'Apache FOP (Formatting\n',
320+
b'Objects Processor) est\n',
321+
b'une application de mise en\n',
322+
b'page de documents res-\n',
323+
b'pectant le standard XSL-\n',
324+
b'\n',
325+
b'See the FOP website for more information\n',
326+
b'\n',
327+
b'\x0cThis is the page header\n',
328+
b'\n',
329+
b'Page 5\n',
330+
b'\n',
331+
b'FO. \xc3\x80 partir d\xe2\x80\x99un document\n',
332+
b'va effectue une mise en\n',
333+
b'au format XSL-FO, cette\n',
334+
b'page et renvoie un docu-\n',
335+
b'ment pr\xc3\xaat pour impression.\n',
336+
b'application \xc3\xa9crite en Ja-\n',
337+
b'This fo:block element spans all the columns of the docu-\n',
338+
b'ment. This is intended to test the abilities of the text-to-\n',
339+
b'speech program.\n',
340+
b'And now we are back to\n',
341+
b'normal content flowing in\n',
342+
b'two columns. Let\xe2\x80\x99s start a\n',
343+
b'numbered list:\n',
344+
b'1. Line 1 of item 1\n',
345+
b'Line 2 of item 1\n',
346+
b'\n',
347+
b'Line 3 of item 1\n',
348+
b'2. Line 1 of item 2\n',
349+
b'Line 2 of item 2\n',
350+
b'Line 3 of item 2\n',
351+
b'\n',
352+
b'The end of the document\n',
353+
b'has now been reached.\n',
354+
b'\n',
355+
b'\x0c',
356+
]

0 commit comments

Comments
 (0)