代码拉取完成,页面将自动刷新
同步操作将从 openKylin/pillow 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import unittest
from PIL import Image, ImageShow
from .helper import PillowTestCase, hopper, is_win32, on_ci, on_github_actions
class TestImageShow(PillowTestCase):
def test_sanity(self):
dir(Image)
dir(ImageShow)
def test_register(self):
# Test registering a viewer that is not a class
ImageShow.register("not a class")
# Restore original state
ImageShow._viewers.pop()
def test_viewer_show(self):
class TestViewer(ImageShow.Viewer):
methodCalled = False
def show_image(self, image, **options):
self.methodCalled = True
return True
viewer = TestViewer()
ImageShow.register(viewer, -1)
for mode in ("1", "I;16", "LA", "RGB", "RGBA"):
with hopper() as im:
self.assertTrue(ImageShow.show(im))
self.assertTrue(viewer.methodCalled)
# Restore original state
ImageShow._viewers.pop(0)
@unittest.skipUnless(
on_ci() and not (is_win32() and on_github_actions()),
"Only run on CIs; hangs on Windows on GitHub Actions",
)
def test_show(self):
for mode in ("1", "I;16", "LA", "RGB", "RGBA"):
im = hopper(mode)
self.assertTrue(ImageShow.show(im))
def test_viewer(self):
viewer = ImageShow.Viewer()
self.assertIsNone(viewer.get_format(None))
self.assertRaises(NotImplementedError, viewer.get_command, None)
def test_viewers(self):
for viewer in ImageShow._viewers:
viewer.get_command("test.jpg")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。