src/img2pdf_test.py: check that psnr is not zero

This commit is contained in:
Johannes 'josch' Schauer 2020-08-04 23:54:11 +02:00
parent 6c742be642
commit 9bd41dba1e
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -287,6 +287,7 @@ def compare_ghostscript(tmpdir, img, pdf, gsdevice="png16m", exact=True):
check=False, check=False,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
).stderr ).stderr
assert psnr != b"0"
psnr = float(psnr.strip(b"0")) psnr = float(psnr.strip(b"0"))
assert psnr != 0 # or otherwise we would use the exact variant assert psnr != 0 # or otherwise we would use the exact variant
assert psnr > 50 assert psnr > 50
@ -321,6 +322,7 @@ def compare_poppler(tmpdir, img, pdf, exact=True):
check=False, check=False,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
).stderr ).stderr
assert psnr != b"0"
psnr = float(psnr.strip(b"0")) psnr = float(psnr.strip(b"0"))
assert psnr != 0 # or otherwise we would use the exact variant assert psnr != 0 # or otherwise we would use the exact variant
assert psnr > 50 assert psnr > 50
@ -350,6 +352,7 @@ def compare_mupdf(tmpdir, img, pdf, exact=True, cmyk=False):
check=False, check=False,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
).stderr ).stderr
assert psnr != b"0"
psnr = float(psnr.strip(b"0")) psnr = float(psnr.strip(b"0"))
assert psnr != 0 # or otherwise we would use the exact variant assert psnr != 0 # or otherwise we would use the exact variant
assert psnr > 50 assert psnr > 50
@ -410,6 +413,7 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True):
check=False, check=False,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
).stderr ).stderr
assert psnr != b"0"
psnr = float(psnr.strip(b"0")) psnr = float(psnr.strip(b"0"))
assert psnr != 0 # or otherwise we would use the exact variant assert psnr != 0 # or otherwise we would use the exact variant
assert psnr > 50 assert psnr > 50