Skip to content

Commit

Permalink
setup.py tests/: Fixed fstrings to work with python-3.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Apr 14, 2023
1 parent 41c2a31 commit a79522a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def get_gitfiles( directory, submodules=False):
'''
def is_within_git_checkout( d):
while 1:
#log( '{d=}')
#log( 'd={d!r}')
if not d:
break
if os.path.isdir( f'{d}/.git'):
Expand Down Expand Up @@ -417,7 +417,7 @@ def get_git_id( directory):
)
if cp.returncode == 0:
branch = cp.stdout.strip()
log(f'get_git_id(): {directory=} returning {branch=} {sha=} {comment=}')
log(f'get_git_id(): directory={directory!r} returning branch={branch!r} sha={sha!r} comment={comment!r}')
return sha, comment, diff, branch


Expand Down
22 changes: 11 additions & 11 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_add_ink_annot():
page.get_bboxlog()
path = f'{scriptdir}/resources/test_add_ink_annot.pdf'
document.save( path)
print( f'Have saved to: {path=}')
print( f'Have saved to: path={path!r}')

def test_techwriter_append():
print(fitz.__doc__)
Expand All @@ -152,7 +152,7 @@ def test_techwriter_append():
tw = fitz.TextWriter(page.rect)
text = "Red rectangle = TextWriter.text_rect, blue circle = .last_point"
r = tw.append((100, 100), text)
print(f'{r=}')
print(f'r={r!r}')
tw.write_text(page)
page.draw_rect(tw.text_rect, color=fitz.pdfcolor["red"])
page.draw_circle(tw.last_point, 2, color=fitz.pdfcolor["blue"])
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_font():
font = fitz.Font()
print(repr(font))
bbox = font.glyph_bbox( 65)
print( f'{bbox=}')
print( f'bbox={bbox!r}')

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

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

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

print(f'{first_page=}')
print(f'{last_page=}')
print(f'first_page={first_page!r}')
print(f'last_page={last_page!r}')
assert first_page == 'Hello World\n'
assert last_page == 'Hello World\n'

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

print(f'{first_page=}')
print(f'{last_page=}')
print(f'first_page={first_page!r}')
print(f'last_page={last_page!r}')
assert first_page == 'Hello World\n'
assert last_page == 'Hello World\n'

Expand Down Expand Up @@ -333,8 +333,8 @@ def average_color(page):
page.apply_redactions()
pixel_average_after = average_color(page)

print(f'{pixel_average_before=}')
print(f'{pixel_average_after=}')
print(f'pixel_average_before={pixel_average_before!r}')
print(f'pixel_average_after={pixel_average_after!r}')

# Before this bug was fixed:
# pixel_average_before=[130.864323120088, 115.23577810900859, 92.9268559996174]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pixmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_memoryview():
assert samples.strides == (1,)

color = pm.pixel( 100, 100)
print( f'{color=}')
print( f'color={color}')
assert color == (83, 66, 40)

def test_samples_ptr():
Expand Down

0 comments on commit a79522a

Please sign in to comment.