mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Add a test for issue #1813: getlocale() failing under a Turkish locale
(not a problem under 3.x)
This commit is contained in:
commit
5a24d82941
4 changed files with 30 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
from test import support
|
||||
import unittest
|
||||
import codecs
|
||||
import locale
|
||||
import sys, _testcapi, io
|
||||
|
||||
class Queue(object):
|
||||
|
@ -1230,6 +1231,19 @@ class CodecsModuleTest(unittest.TestCase):
|
|||
self.assertRaises(TypeError, codecs.getwriter)
|
||||
self.assertRaises(LookupError, codecs.getwriter, "__spam__")
|
||||
|
||||
def test_lookup_issue1813(self):
|
||||
# Issue #1813: under Turkish locales, lookup of some codecs failed
|
||||
# because 'I' is lowercased as "ı" (dotless i)
|
||||
oldlocale = locale.getlocale(locale.LC_CTYPE)
|
||||
self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
|
||||
try:
|
||||
locale.setlocale(locale.LC_CTYPE, 'tr_TR')
|
||||
except locale.Error:
|
||||
# Unsupported locale on this system
|
||||
self.skipTest('test needs Turkish locale')
|
||||
c = codecs.lookup('ASCII')
|
||||
self.assertEqual(c.name, 'ascii')
|
||||
|
||||
class StreamReaderTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue