summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-24 00:41:54 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-24 00:41:54 (GMT)
commit5a24d82941cec6c207433d75c1120bf4a8438793 (patch)
treef6ff4dc8a76ff2225cf2bd371088733e5f1ef1f3 /Lib/test/test_codecs.py
parent8dbd8573e513248ca4c105d0f580f47e79ab9ec8 (diff)
parent0e3c5a828e65f4f5821dad0e7b0ff4ca9f62f9d3 (diff)
downloadcpython-5a24d82941cec6c207433d75c1120bf4a8438793.zip
cpython-5a24d82941cec6c207433d75c1120bf4a8438793.tar.gz
cpython-5a24d82941cec6c207433d75c1120bf4a8438793.tar.bz2
Add a test for issue #1813: getlocale() failing under a Turkish locale
(not a problem under 3.x)
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index c0450e7..247e2b8 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -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):