summaryrefslogtreecommitdiff
path: root/openid
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@nic.cz>2018-05-02 15:28:59 +0200
committerVlastimil Zíma <vlastimil.zima@nic.cz>2018-05-11 10:05:43 +0200
commit2a28ff0db2ee6b2842bf09afeb037026ab9c9a9f (patch)
tree3684088b50de9564e166ccc9a34d76a2705b9bfa /openid
parent85574cd2161cf74782f51b04e988d83200bb2bf4 (diff)
downloadopenid-2a28ff0db2ee6b2842bf09afeb037026ab9c9a9f.tar.gz
Drop unused toUnicode utility function
Diffstat (limited to 'openid')
-rw-r--r--openid/oidutil.py15
-rw-r--r--openid/test/test_oidutil.py13
2 files changed, 1 insertions, 27 deletions
diff --git a/openid/oidutil.py b/openid/oidutil.py
index 34732ac..6e688fb 100644
--- a/openid/oidutil.py
+++ b/openid/oidutil.py
@@ -5,7 +5,7 @@ For users of this library, the C{L{log}} function is probably the most
interesting.
"""
-__all__ = ['log', 'appendArgs', 'toBase64', 'fromBase64', 'autoSubmitHTML', 'toUnicode']
+__all__ = ['log', 'appendArgs', 'toBase64', 'fromBase64', 'autoSubmitHTML']
import binascii
import logging
@@ -17,19 +17,6 @@ import six
_LOGGER = logging.getLogger(__name__)
-def toUnicode(value):
- """Returns the given argument as a unicode object.
-
- @param value: A UTF-8 encoded string or a unicode (coercable) object
- @type message: str or unicode
-
- @returns: Unicode object representing the input value.
- """
- if isinstance(value, str):
- return value.decode('utf-8')
- return unicode(value)
-
-
def autoSubmitHTML(form, title='OpenID transaction in progress'):
return """
<html>
diff --git a/openid/test/test_oidutil.py b/openid/test/test_oidutil.py
index 0b499c8..9713de8 100644
--- a/openid/test/test_oidutil.py
+++ b/openid/test/test_oidutil.py
@@ -137,19 +137,6 @@ class AppendArgsTest(unittest.TestCase):
self.assertEqual(expected, result, '{} {}'.format(name, args))
-class TestUnicodeConversion(unittest.TestCase):
-
- def test_toUnicode(self):
- # Unicode objects pass through
- self.assertIsInstance(oidutil.toUnicode(u'fööbär'), unicode)
- self.assertEquals(oidutil.toUnicode(u'fööbär'), u'fööbär')
- # UTF-8 encoded string are decoded
- self.assertIsInstance(oidutil.toUnicode('fööbär'), unicode)
- self.assertEquals(oidutil.toUnicode('fööbär'), u'fööbär')
- # Other encodings raise exceptions
- self.assertRaises(UnicodeDecodeError, lambda: oidutil.toUnicode(u'fööbär'.encode('latin-1')))
-
-
class TestSymbol(unittest.TestCase):
def testCopyHash(self):
import copy