Merge pull request #6141 from radarhere/imports

This commit is contained in:
Hugo van Kemenade 2022-03-22 23:27:03 +02:00 committed by GitHub
commit d0f1f663d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -4,7 +4,6 @@ import itertools
import os import os
import re import re
from collections import namedtuple from collections import namedtuple
from ctypes import c_float
import pytest import pytest
@ -168,14 +167,11 @@ class TestFileLibTiff(LibTiffTestCase):
val = original[tag] val = original[tag]
if tag.endswith("Resolution"): if tag.endswith("Resolution"):
if legacy_api: if legacy_api:
assert ( assert val[0][0] / val[0][1] == (
c_float(val[0][0] / val[0][1]).value 4294967295 / 113653537
== c_float(value[0][0] / value[0][1]).value
), f"{tag} didn't roundtrip" ), f"{tag} didn't roundtrip"
else: else:
assert ( assert val == 37.79000115940079, f"{tag} didn't roundtrip"
c_float(val).value == c_float(value).value
), f"{tag} didn't roundtrip"
else: else:
assert val == value, f"{tag} didn't roundtrip" assert val == value, f"{tag} didn't roundtrip"

View File

@ -1,4 +1,3 @@
import ctypes
import os import os
import subprocess import subprocess
import sys import sys
@ -404,6 +403,8 @@ class TestEmbeddable:
"not from shell", "not from shell",
) )
def test_embeddable(self): def test_embeddable(self):
import ctypes
with open("embed_pil.c", "w") as fh: with open("embed_pil.c", "w") as fh:
fh.write( fh.write(
""" """

View File

@ -1,4 +1,3 @@
import ctypes
from io import BytesIO from io import BytesIO
from PIL import Image, ImageWin from PIL import Image, ImageWin
@ -8,6 +7,7 @@ from .helper import hopper, is_win32
# see https://github.com/python-pillow/Pillow/pull/1431#issuecomment-144692652 # see https://github.com/python-pillow/Pillow/pull/1431#issuecomment-144692652
if is_win32(): if is_win32():
import ctypes
import ctypes.wintypes import ctypes.wintypes
class BITMAPFILEHEADER(ctypes.Structure): class BITMAPFILEHEADER(ctypes.Structure):