summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunai <andrew@dun.ai>2018-01-23 22:03:05 +0200
committerAndrew Dunai <andrew@dun.ai>2018-01-23 22:03:05 +0200
commit27728261a4eba648c2c0b084258baaf39e35d896 (patch)
tree02828c17177cd02fdc114205e0a3179d8a698f3b
parent5dcf236d025281034f0d22ae13f827e930e3a6f4 (diff)
downloadurwid-27728261a4eba648c2c0b084258baaf39e35d896.tar.gz
Added test.
-rw-r--r--urwid/tests/test_util.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/urwid/tests/test_util.py b/urwid/tests/test_util.py
index 5f0531d..3a1dda7 100644
--- a/urwid/tests/test_util.py
+++ b/urwid/tests/test_util.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
+import locale
import urwid
from urwid import util
@@ -176,3 +177,18 @@ class TagMarkupTest(unittest.TestCase):
def test_bad_type(self):
self.assertRaises(urwid.TagMarkupException, lambda:
urwid.decompose_tagmarkup(5))
+
+
+class PortabilityTest(unittest.TestCase):
+ def test_locale(self):
+ initial = locale.getlocale()
+
+ locale.setlocale(locale.LC_ALL, (None, None))
+ util.detect_encoding()
+ self.assertEqual(locale.getlocale(), (None, None))
+
+ locale.setlocale(locale.LC_ALL, ('en_US', 'UTF-8'))
+ util.detect_encoding()
+ self.assertEqual(locale.getlocale(), ('en_US', 'UTF-8'))
+
+ locale.setlocale(locale.LC_ALL, initial)