Replace several uses of str(path) with fspath(path)

Helps make it more explicit. Did not do this to tests because use of paths
is more involved there.
This commit is contained in:
James R. Barlow
2018-06-22 21:00:47 -07:00
parent 324598e992
commit 76e7e8dbbb
5 changed files with 13 additions and 17 deletions
+1 -5
View File
@@ -34,8 +34,7 @@ import sys
@pytest.fixture
def blank_hocr(tmpdir):
filename = Path(str(tmpdir)) / "blank.hocr"
with open(str(filename), 'w') as f:
f.write(HOCR_TEMPLATE)
filename.write_text(HOCR_TEMPLATE)
return filename
@@ -50,6 +49,3 @@ def test_mono_image(blank_hocr, outdir):
str(outdir / 'mono.pdf'), imageFileName=str(outdir / 'mono.tif'))
qpdf.check(str(outdir / 'mono.pdf'))
+3 -3
View File
@@ -56,8 +56,8 @@ def check_monochrome_correlation(
rasterize(reference_pdf, reference_pageno, reference_png)
rasterize(test_pdf, test_pageno, test_png)
pix_ref = leptonica.Pix.read(str(reference_png))
pix_test = leptonica.Pix.read(str(test_png))
pix_ref = leptonica.Pix.open(reference_png)
pix_test = leptonica.Pix.open(test_png)
return leptonica.Pix.correlation_binary(pix_ref, pix_test)
@@ -127,7 +127,7 @@ def test_rotated_skew_timeout(resources, outpdf):
timeout produced a page whose dimensions did not match the original's.
"""
input_file = str(resources / 'rotated_skew.pdf')
input_file = resources / 'rotated_skew.pdf'
in_pageinfo = PdfInfo(input_file)[0]
assert in_pageinfo.height_pixels < in_pageinfo.width_pixels, \