MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / do

Function do

tests/test_pixmap.py:332–358  ·  view source on GitHub ↗
(gi)

Source from the content-addressed store, hash-verified

330 gi_pythonpath = os.path.abspath(f'{gi}/../..')
331
332 def do(gi):
333 # Run code that will import gi and pymupdf in different orders, and
334 # return contents of generated .png file as a bytes.
335 out = f'{root}/tests/resources/test_3493_{gi}.png'
336 run_code(
337 f'''
338 if {gi}==0:
339 import pymupdf
340 elif {gi}==1:
341 from gi.repository import GdkPixbuf
342 import pymupdf
343 elif {gi}==2:
344 import pymupdf
345 from gi.repository import GdkPixbuf
346 else:
347 assert 0
348 document = pymupdf.Document('{in_path}')
349 page = document[0]
350 print(f'{gi=}: saving to: {out}')
351 page.get_pixmap().save('{out}')
352 '''
353 ,
354 os.path.abspath(f'{root}/tests/resources/test_3493_{gi}.py'),
355 pythonpath=gi_pythonpath,
356 )
357 with open(out, 'rb') as f:
358 return f.read()
359
360 out0 = do(0)
361 out1 = do(1)

Callers 1

test_3493Function · 0.85

Calls 1

run_codeFunction · 0.85

Tested by

no test coverage detected