Skip to content

Commit a79522a

Browse files
setup.py tests/: Fixed fstrings to work with python-3.7.
1 parent 41c2a31 commit a79522a

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def get_gitfiles( directory, submodules=False):
247247
'''
248248
def is_within_git_checkout( d):
249249
while 1:
250-
#log( '{d=}')
250+
#log( 'd={d!r}')
251251
if not d:
252252
break
253253
if os.path.isdir( f'{d}/.git'):
@@ -417,7 +417,7 @@ def get_git_id( directory):
417417
)
418418
if cp.returncode == 0:
419419
branch = cp.stdout.strip()
420-
log(f'get_git_id(): {directory=} returning {branch=} {sha=} {comment=}')
420+
log(f'get_git_id(): directory={directory!r} returning branch={branch!r} sha={sha!r} comment={comment!r}')
421421
return sha, comment, diff, branch
422422

423423

tests/test_general.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_add_ink_annot():
143143
page.get_bboxlog()
144144
path = f'{scriptdir}/resources/test_add_ink_annot.pdf'
145145
document.save( path)
146-
print( f'Have saved to: {path=}')
146+
print( f'Have saved to: path={path!r}')
147147

148148
def test_techwriter_append():
149149
print(fitz.__doc__)
@@ -152,7 +152,7 @@ def test_techwriter_append():
152152
tw = fitz.TextWriter(page.rect)
153153
text = "Red rectangle = TextWriter.text_rect, blue circle = .last_point"
154154
r = tw.append((100, 100), text)
155-
print(f'{r=}')
155+
print(f'r={r!r}')
156156
tw.write_text(page)
157157
page.draw_rect(tw.text_rect, color=fitz.pdfcolor["red"])
158158
page.draw_circle(tw.last_point, 2, color=fitz.pdfcolor["blue"])
@@ -189,7 +189,7 @@ def test_font():
189189
font = fitz.Font()
190190
print(repr(font))
191191
bbox = font.glyph_bbox( 65)
192-
print( f'{bbox=}')
192+
print( f'bbox={bbox!r}')
193193

194194
def test_insert_font():
195195
doc=fitz.open(f'{scriptdir}/resources/v110-changes.pdf')
@@ -200,7 +200,7 @@ def test_insert_font():
200200
def test_2173():
201201
from fitz import IRect, Pixmap, CS_RGB, Colorspace
202202
for i in range( 100):
203-
#print( f'{i=}')
203+
#print( f'i={i!r}')
204204
image = Pixmap(Colorspace(CS_RGB), IRect(0, 0, 13, 37))
205205
print( 'test_2173() finished')
206206

@@ -211,7 +211,7 @@ def test_texttrace():
211211
for page in document:
212212
tt = page.get_texttrace()
213213
t = time.time() - t
214-
print( f'test_texttrace(): {t=}')
214+
print( f'test_texttrace(): t={t!r}')
215215

216216
# Repeat, this time writing data to file.
217217
import json
@@ -274,16 +274,16 @@ def test_2238():
274274
first_page = doc.load_page(0).get_text('text', fitz.INFINITE_RECT())
275275
last_page = doc.load_page(-1).get_text('text', fitz.INFINITE_RECT())
276276

277-
print(f'{first_page=}')
278-
print(f'{last_page=}')
277+
print(f'first_page={first_page!r}')
278+
print(f'last_page={last_page!r}')
279279
assert first_page == 'Hello World\n'
280280
assert last_page == 'Hello World\n'
281281

282282
first_page = doc.load_page(0).get_text('text')
283283
last_page = doc.load_page(-1).get_text('text')
284284

285-
print(f'{first_page=}')
286-
print(f'{last_page=}')
285+
print(f'first_page={first_page!r}')
286+
print(f'last_page={last_page!r}')
287287
assert first_page == 'Hello World\n'
288288
assert last_page == 'Hello World\n'
289289

@@ -333,8 +333,8 @@ def average_color(page):
333333
page.apply_redactions()
334334
pixel_average_after = average_color(page)
335335

336-
print(f'{pixel_average_before=}')
337-
print(f'{pixel_average_after=}')
336+
print(f'pixel_average_before={pixel_average_before!r}')
337+
print(f'pixel_average_after={pixel_average_after!r}')
338338

339339
# Before this bug was fixed:
340340
# pixel_average_before=[130.864323120088, 115.23577810900859, 92.9268559996174]

tests/test_pixmap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_memoryview():
105105
assert samples.strides == (1,)
106106

107107
color = pm.pixel( 100, 100)
108-
print( f'{color=}')
108+
print( f'color={color}')
109109
assert color == (83, 66, 40)
110110

111111
def test_samples_ptr():

0 commit comments

Comments
 (0)