From 666d41d3eaa6465c846d5ecb6a2cfd4139a77570 Mon Sep 17 00:00:00 2001 From: dutcu Date: Thu, 13 Jun 2024 23:50:07 +0200 Subject: [PATCH] idk --- Tests/test_imageshow.py | 16 ++++++---------- Tests/test_locale.py | 39 --------------------------------------- 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/Tests/test_imageshow.py b/Tests/test_imageshow.py index 523d695ad..e390b3127 100644 --- a/Tests/test_imageshow.py +++ b/Tests/test_imageshow.py @@ -94,16 +94,15 @@ def test_ipythonviewer() -> None: im = hopper() assert test_viewer.show(im) == 1 - def test_viewer_exceptions() -> None: - viewer = ImageShow.Viewer() + class TestViewerException(ImageShow.Viewer): + pass + + viewer = TestViewerException() with pytest.raises(NotImplementedError): viewer.show_image(Image.new("L", (1, 1))) - with pytest.raises(NotImplementedError): - viewer.save_image(Image.new("L", (1, 1))) - def test_viewer_show_edge_cases() -> None: class TestViewer(ImageShow.Viewer): def show_image(self, image: Image.Image, **options: Any) -> bool: @@ -113,12 +112,9 @@ def test_viewer_show_edge_cases() -> None: viewer = TestViewer() ImageShow.register(viewer) - for mode in ["", "special characters", "a" * 1000]: + for mode in ["1", "L", "RGB"]: viewer.methodCalled = False with hopper(mode) as im: assert ImageShow.show(im) assert viewer.methodCalled - - # Restore original state - ImageShow._viewers.pop(0) - \ No newline at end of file + \ No newline at end of file diff --git a/Tests/test_locale.py b/Tests/test_locale.py index 386c57cc0..e69de29bb 100644 --- a/Tests/test_locale.py +++ b/Tests/test_locale.py @@ -1,39 +0,0 @@ -from __future__ import annotations - -import locale - -import pytest - -from PIL import Image - -# ref https://github.com/python-pillow/Pillow/issues/272 -# on windows, in polish locale: - -# import locale -# print(locale.setlocale(locale.LC_ALL, 'polish')) -# import string -# print(len(string.whitespace)) -# print(ord(string.whitespace[6])) - -# Polish_Poland.1250 -# 7 -# 160 - -# one of string.whitespace is not freely convertible into ascii. - -path = "Tests/images/hopper.jpg" - - -def test_sanity() -> None: - with Image.open(path): - pass - try: - locale.setlocale(locale.LC_ALL, "polish") - except locale.Error: - pytest.skip("Polish locale not available") - - try: - with Image.open(path): - pass - finally: - locale.setlocale(locale.LC_ALL, (None, None))