2016-11-26 03:05:56 +03:00
|
|
|
from __future__ import print_function
|
2019-07-06 23:40:53 +03:00
|
|
|
|
|
|
|
import locale
|
2014-06-10 13:10:47 +04:00
|
|
|
|
2013-07-09 09:16:25 +04:00
|
|
|
from PIL import Image
|
|
|
|
|
2019-07-06 23:40:53 +03:00
|
|
|
from .helper import PillowTestCase, unittest
|
2013-07-09 09:16:25 +04:00
|
|
|
|
2014-06-03 14:02:44 +04:00
|
|
|
# ref https://github.com/python-pillow/Pillow/issues/272
|
2014-06-10 13:10:47 +04:00
|
|
|
# on windows, in polish locale:
|
2013-07-09 09:16:25 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
# import locale
|
2016-11-19 03:19:43 +03:00
|
|
|
# print(locale.setlocale(locale.LC_ALL, 'polish'))
|
2014-06-10 13:10:47 +04:00
|
|
|
# import string
|
2016-11-19 03:19:43 +03:00
|
|
|
# print(len(string.whitespace))
|
|
|
|
# print(ord(string.whitespace[6]))
|
2013-07-09 09:16:25 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
# Polish_Poland.1250
|
|
|
|
# 7
|
|
|
|
# 160
|
2013-07-09 09:16:25 +04:00
|
|
|
|
2014-06-03 14:02:44 +04:00
|
|
|
# one of string.whitespace is not freely convertable into ascii.
|
2013-07-09 09:16:25 +04:00
|
|
|
|
2014-09-05 14:03:56 +04:00
|
|
|
path = "Tests/images/hopper.jpg"
|
2013-07-09 09:16:25 +04:00
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestLocale(PillowTestCase):
|
|
|
|
def test_sanity(self):
|
|
|
|
Image.open(path)
|
|
|
|
try:
|
|
|
|
locale.setlocale(locale.LC_ALL, "polish")
|
2018-06-11 09:00:57 +03:00
|
|
|
except locale.Error:
|
2019-06-13 18:54:46 +03:00
|
|
|
unittest.skip("Polish locale not available")
|
2019-09-23 13:26:34 +03:00
|
|
|
|
|
|
|
try:
|
|
|
|
Image.open(path)
|
|
|
|
finally:
|
|
|
|
locale.setlocale(locale.LC_ALL, (None, None))
|