Skip to content

Commit f2f83a1

Browse files
tests/test_general.py: test_open2(): minor changes.
1 parent 5da3841 commit f2f83a1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tests/test_general.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,9 @@ def dict_set_path(dict_, *items):
14831483
for path in paths:
14841484
print(path)
14851485
for ext in extensions:
1486-
path2 = f'foo{ext}'
1487-
shutil.copy2(f'{root}/{path}', path2)
1486+
path2 = f'{root}/foo{ext}'
1487+
path3 = shutil.copy2(f'{root}/{path}', path2)
1488+
assert(path3 == path2)
14881489

14891490
# Test fz_open_document().
14901491
e = None
@@ -1495,7 +1496,7 @@ def dict_set_path(dict_, *items):
14951496
e = ee
14961497
wt = pymupdf.TOOLS.mupdf_warnings()
14971498
text = get_result(e, document)
1498-
print(f' fz_open_document({path2}) => {text}')
1499+
print(f' fz_open_document({path2}) => {text}')
14991500
dict_set_path(results, path, ext, 'file', text)
15001501

15011502
# Test fz_open_document_with_stream().
@@ -1521,6 +1522,7 @@ def dict_set_path(dict_, *items):
15211522
with open(path_html, 'w') as f:
15221523
f.write(f'<html>\n')
15231524
f.write(f'<body>\n')
1525+
f.write(f'<p>{time.strftime("%F-%T")}\n')
15241526
f.write(f'<table border="1" style="border-collapse:collapse" cellpadding="4">\n')
15251527
f.write(f'<tr><td></td><th colspan="{len(extensions)}">Extension/magic')
15261528
f.write(f'<tr><th style="border-bottom: 4px solid black; border-right: 4px solid black;">Data file</th>')
@@ -1540,18 +1542,21 @@ def dict_set_path(dict_, *items):
15401542
else:
15411543
f.write(f'<td>{b1}{text_file}{b2}</td>')
15421544
else:
1543-
f.write(f'<td>file: {b1}{text_file}{b2}</td><br>')
1544-
f.write(f'<td>stream: {b1}{text_stream}{b2}</td>')
1545+
f.write(f'<td>file: {b1}{text_file}{b2}<br>')
1546+
f.write(f'stream: {b1}{text_stream}{b2}</td>')
15451547
f.write('</tr>\n')
15461548
f.write(f'</table>\n')
15471549
f.write(f'/<body>\n')
15481550
f.write(f'</html>\n')
15491551
print(f'Have created: {path_html}')
15501552

1551-
with open(os.path.normpath(f'{__file__}/../../tests/resources/test_open2_expected.json')) as f:
1552-
results_expected = json.load(f)
1553-
1553+
path_out = os.path.normpath(f'{__file__}/../../tests/test_open2.json')
1554+
with open(path_out, 'w') as f:
1555+
json.dump(results, f, indent=4, sort_keys=1)
1556+
15541557
if pymupdf.mupdf_version_tuple >= (1, 26):
1558+
with open(os.path.normpath(f'{__file__}/../../tests/resources/test_open2_expected.json')) as f:
1559+
results_expected = json.load(f)
15551560
if results != results_expected:
15561561
print(f'results != results_expected:')
15571562
def show(r, name):

0 commit comments

Comments
 (0)