@@ -86,13 +86,11 @@ def test_wrapcontents():
8686 page .set_contents (xref )
8787 assert len (page .get_contents ()) == 1
8888 page .clean_contents ()
89- rebased = hasattr (pymupdf , 'mupdf' )
90- if rebased :
91- wt = pymupdf .TOOLS .mupdf_warnings ()
92- if (1 , 26 , 0 ) <= pymupdf .mupdf_version_tuple < (1 , 27 ):
93- assert wt == 'bogus font ascent/descent values (0 / 0)\n PDF stream Length incorrect'
94- else :
95- assert wt == 'PDF stream Length incorrect'
89+ wt = pymupdf .TOOLS .mupdf_warnings ()
90+ if (1 , 26 , 0 ) <= pymupdf .mupdf_version_tuple < (1 , 27 ):
91+ assert wt == 'bogus font ascent/descent values (0 / 0)\n PDF stream Length incorrect'
92+ else :
93+ assert wt == 'PDF stream Length incorrect'
9694
9795
9896def test_page_clean_contents ():
@@ -300,8 +298,8 @@ def test_2533():
300298 Search for a unique char on page and confirm that page.get_texttrace()
301299 returns the same bbox as the search method.
302300 """
303- if hasattr ( pymupdf , 'mupdf' ) and not pymupdf .g_use_extra :
304- print ('Not running test_2533() because rebased with use_extra=0 known to fail' )
301+ if not pymupdf .g_use_extra :
302+ print ('Not running test_2533() because use_extra=0 known to fail' )
305303 return
306304 pymupdf .TOOLS .set_small_glyph_heights (True )
307305 try :
@@ -412,18 +410,16 @@ def test_2108():
412410def test_2238 ():
413411 filepath = f'{ scriptdir } /resources/test2238.pdf'
414412 doc = pymupdf .open (filepath )
415- rebased = hasattr (pymupdf , 'mupdf' )
416- if rebased :
417- wt = pymupdf .TOOLS .mupdf_warnings ()
418- wt_expected = ''
419- if pymupdf .mupdf_version_tuple >= (1 , 26 ):
420- wt_expected += 'garbage bytes before version marker\n '
421- wt_expected += 'syntax error: expected \' obj\' keyword (6 0 ?)\n '
422- else :
423- wt_expected += 'format error: cannot recognize version marker\n '
424- wt_expected += 'trying to repair broken xref\n '
425- wt_expected += 'repairing PDF document'
426- assert wt == wt_expected , f'{ wt = } '
413+ wt = pymupdf .TOOLS .mupdf_warnings ()
414+ wt_expected = ''
415+ if pymupdf .mupdf_version_tuple >= (1 , 26 ):
416+ wt_expected += 'garbage bytes before version marker\n '
417+ wt_expected += 'syntax error: expected \' obj\' keyword (6 0 ?)\n '
418+ else :
419+ wt_expected += 'format error: cannot recognize version marker\n '
420+ wt_expected += 'trying to repair broken xref\n '
421+ wt_expected += 'repairing PDF document'
422+ assert wt == wt_expected , f'{ wt = } '
427423 first_page = doc .load_page (0 ).get_text ('text' , clip = pymupdf .INFINITE_RECT ())
428424 last_page = doc .load_page (- 1 ).get_text ('text' , clip = pymupdf .INFINITE_RECT ())
429425
@@ -619,7 +615,6 @@ def test_2596():
619615 page = doc .reload_page (page )
620616 pix1 = page .get_pixmap ()
621617 assert pix1 .samples == pix0 .samples
622- rebased = hasattr (pymupdf , 'mupdf' )
623618 if pymupdf .mupdf_version_tuple < (1 , 26 , 6 ):
624619 wt = pymupdf .TOOLS .mupdf_warnings ()
625620 assert wt == 'too many indirections (possible indirection cycle involving 24 0 R)'
@@ -747,14 +742,12 @@ def assert_rects_approx_eq(a, b):
747742 print (f'test_2710(): { pymupdf .mupdf_version_tuple = } ' )
748743 # 2023-11-05: Currently broken in mupdf master.
749744 print (f'test_2710(): Not Checking page.rect and rect.' )
750- rebased = hasattr (pymupdf , 'mupdf' )
751- if rebased :
752- wt = pymupdf .TOOLS .mupdf_warnings ()
753- assert wt == (
754- "syntax error: cannot find ExtGState resource 'GS7'\n "
755- "syntax error: cannot find ExtGState resource 'GS8'\n "
756- "encountered syntax errors; page may not be correct"
757- )
745+ wt = pymupdf .TOOLS .mupdf_warnings ()
746+ assert wt == (
747+ "syntax error: cannot find ExtGState resource 'GS7'\n "
748+ "syntax error: cannot find ExtGState resource 'GS8'\n "
749+ "encountered syntax errors; page may not be correct"
750+ )
758751
759752
760753def test_2736 ():
@@ -930,8 +923,6 @@ def test_3081():
930923 path1 = os .path .abspath (f'{ __file__ } /../../tests/resources/1.pdf' )
931924 path2 = os .path .abspath (f'{ __file__ } /../../tests/test_3081-2.pdf' )
932925
933- rebased = hasattr (pymupdf , 'mupdf' )
934-
935926 import shutil
936927 import sys
937928 import traceback
@@ -953,9 +944,8 @@ def next_fd():
953944 page = document [0 ]
954945 fd2 = next_fd ()
955946 document .close ()
956- if rebased :
957- assert document .this is None
958- assert page .this is None
947+ assert document .this is None
948+ assert page .this is None
959949 try :
960950 document .page_count ()
961951 except Exception as e :
@@ -970,10 +960,7 @@ def next_fd():
970960 except Exception as e :
971961 print (f'Received expected exception: { e } ' )
972962 #traceback.print_exc(file=sys.stdout)
973- if rebased :
974- assert str (e ) == 'page is None'
975- else :
976- assert str (e ) == 'orphaned object: parent is None'
963+ assert str (e ) == 'page is None'
977964 else :
978965 assert 0 , 'Did not receive expected exception.'
979966 page = None
@@ -996,17 +983,11 @@ def test_3112_set_xml_metadata():
996983 document .set_xml_metadata ('hello world' )
997984
998985def test_archive_3126 ():
999- if not hasattr (pymupdf , 'mupdf' ):
1000- print (f'Not running because known to fail with classic.' )
1001- return
1002986 p = os .path .abspath (f'{ __file__ } /../../tests/resources' )
1003987 p = pathlib .Path (p )
1004988 archive = pymupdf .Archive (p )
1005989
1006990def test_3140 ():
1007- if not hasattr (pymupdf , 'mupdf' ):
1008- print (f'Not running test_3140 on classic, because Page.insert_htmlbox() not available.' )
1009- return
1010991 css2 = ''
1011992 path = os .path .abspath (f'{ __file__ } /../../tests/resources/2.pdf' )
1012993 oldfile = os .path .abspath (f'{ __file__ } /../../tests/test_3140_old.pdf' )
@@ -1043,9 +1024,6 @@ def test_cli():
10431024 print ('test_cli(): not running on Pyodide - cannot run child processes.' )
10441025 return
10451026
1046- if not hasattr (pymupdf , 'mupdf' ):
1047- print ('test_cli(): Not running on classic because of fitz_old.' )
1048- return
10491027 import subprocess
10501028 subprocess .run (f'pymupdf -h' , shell = 1 , check = 1 )
10511029
@@ -1108,9 +1086,6 @@ def test_cli_out():
11081086 print ('test_cli_out(): not running on Pyodide - cannot run child processes.' )
11091087 return
11101088
1111- if not hasattr (pymupdf , 'mupdf' ):
1112- print ('test_cli(): Not running on classic because of fitz_old.' )
1113- return
11141089 import platform
11151090 import re
11161091 import subprocess
@@ -1395,10 +1370,6 @@ def relpath(path, start=None):
13951370
13961371def test_open ():
13971372
1398- if not hasattr (pymupdf , 'mupdf' ):
1399- print ('test_open(): not running on classic.' )
1400- return
1401-
14021373 import re
14031374 import textwrap
14041375 import traceback
@@ -1650,9 +1621,6 @@ def show(r, name):
16501621
16511622
16521623def test_533 ():
1653- if not hasattr (pymupdf , 'mupdf' ):
1654- print ('test_533(): Not running on classic.' )
1655- return
16561624 path = os .path .abspath (f'{ __file__ } /../../tests/resources/2.pdf' )
16571625 doc = pymupdf .open (path )
16581626 print ()
0 commit comments