]> granicus.if.org Git - python/commitdiff
Add a test for issue #1813: getlocale() failing under a Turkish locale
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 24 Jul 2011 00:40:25 +0000 (02:40 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 24 Jul 2011 00:40:25 +0000 (02:40 +0200)
(not a problem under 3.x)

Lib/test/test_locale.py

index e959343cca59114d86fc74295d3963cd73a01bd7..5155923c91a31c74ac30d9a941711abbc97a25ef 100644 (file)
@@ -391,6 +391,19 @@ class TestMiscellaneous(unittest.TestCase):
         # crasher from bug #7419
         self.assertRaises(locale.Error, locale.setlocale, 12345)
 
+    def test_getsetlocale_issue1813(self):
+        # Issue #1813: setting and getting the locale under a Turkish locale
+        oldlocale = locale.getlocale()
+        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')
+        loc = locale.getlocale()
+        locale.setlocale(locale.LC_CTYPE, loc)
+        self.assertEqual(loc, locale.getlocale())
+
 
 def test_main():
     tests = [