Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3bfe69c

Browse files
authored
Merge pull request#19830 from meeseeksmachine/auto-backport-of-pr-19824-on-v3.4.x
Backport PR#19824 on branch v3.4.x (Access pdf annotations while inside pikepdf.Pdf context manager.)
2 parentsebc9277 +fb53459 commit3bfe69c

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

‎lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,15 @@ def test_text_urls():
227227
withpikepdf.Pdf.open(fd)aspdf:
228228
annots=pdf.pages[0].Annots
229229

230-
fory,fragmentin [('0.1','plain'), ('0.4','mathtext')]:
231-
annot=next(
232-
(aforainannotsifa.A.URI==f'{test_url}{fragment}'),
233-
None)
234-
assertannotisnotNone
235-
# Positions in points (72 per inch.)
236-
assertannot.Rect[1]==decimal.Decimal(y)*72
230+
# Iteration over Annots must occur within the context manager,
231+
# otherwise it may fail depending on the pdf structure.
232+
fory,fragmentin [('0.1','plain'), ('0.4','mathtext')]:
233+
annot=next(
234+
(aforainannotsifa.A.URI==f'{test_url}{fragment}'),
235+
None)
236+
assertannotisnotNone
237+
# Positions in points (72 per inch.)
238+
assertannot.Rect[1]==decimal.Decimal(y)*72
237239

238240

239241
@needs_usetex
@@ -251,12 +253,14 @@ def test_text_urls_tex():
251253
withpikepdf.Pdf.open(fd)aspdf:
252254
annots=pdf.pages[0].Annots
253255

254-
annot=next(
255-
(aforainannotsifa.A.URI==f'{test_url}tex'),
256-
None)
257-
assertannotisnotNone
258-
# Positions in points (72 per inch.)
259-
assertannot.Rect[1]==decimal.Decimal('0.7')*72
256+
# Iteration over Annots must occur within the context manager,
257+
# otherwise it may fail depending on the pdf structure.
258+
annot=next(
259+
(aforainannotsifa.A.URI==f'{test_url}tex'),
260+
None)
261+
assertannotisnotNone
262+
# Positions in points (72 per inch.)
263+
assertannot.Rect[1]==decimal.Decimal('0.7')*72
260264

261265

262266
deftest_pdfpages_fspath():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp