# Path: openid/oidutil.py
# def autoSubmitHTML(form, title='OpenID transaction in progress'):
# def log(message, level=0):
# def appendArgs(url, args):
# def toBase64(s):
# def fromBase64(s):
#     def __init__(self, name):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def __repr__(self):
# def string_to_text(value, deprecate_msg):
# def force_text(value):
# class Symbol(object):
# 
# Path: openid/oidutil.py
# def force_text(value):
#     """
#     Return a text object representing value in UTF-8 encoding.
#     """
#     if isinstance(value, six.text_type):
#         # It's already a text, just return it.
#         return value
#     elif isinstance(value, bytes):
#         # It's a byte string, decode it.
#         return value.decode('utf-8')
#     else:
#         # It's not a string, convert it.
#         return six.text_type(value)
# 
# def string_to_text(value, deprecate_msg):
#     """
#     Return input string coverted to text string.
# 
#     If input is text, it is returned as is.
#     If input is binary, it is decoded using UTF-8 to text.
#     """
#     assert isinstance(value, (six.text_type, six.binary_type))
#     if isinstance(value, six.binary_type):
#         warnings.warn(deprecate_msg, DeprecationWarning)
#         value = value.decode('utf-8')
#     return value


import random
import string
import unittest
import warnings
import six
        import copy
from mock import sentinel
from testfixtures import ShouldWarn
from openid import oidutil
from openid.oidutil import force_text, string_to_text

        cases = [
            b'',
            b'x',
            b'\x00',
            b'\x01',
            b'\x00' * 100,
        ]
        if six.PY2:
            cases.append(b''.join(chr(i) for i in range(256)))
        else:
            assert six.PY3
            cases.append(bytes(i for i in range(256)))

        for s in cases:
            b64 = oidutil.toBase64(s)
            checkEncoded(b64)
            s_prime = oidutil.fromBase64(b64)
            assert s_prime == s, (s, b64, s_prime)

        # Randomized test
        for _ in range(50):
            n = random.randrange(2048)
            if six.PY2:
                s = b''.join(chr(random.randrange(256)) for i in range(n))
            else:
                assert six.PY3
                s = bytes(random.randrange(256) for i in range(n))
            b64 = oidutil.toBase64(s)
            checkEncoded(b64)

# Path: openid/oidutil.py
# def autoSubmitHTML(form, title='OpenID transaction in progress'):
# def log(message, level=0):
# def appendArgs(url, args):
# def toBase64(s):
# def fromBase64(s):
#     def __init__(self, name):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def __repr__(self):
# def string_to_text(value, deprecate_msg):
# def force_text(value):
# class Symbol(object):
# 
# Path: openid/oidutil.py
# def force_text(value):
#     """
#     Return a text object representing value in UTF-8 encoding.
#     """
#     if isinstance(value, six.text_type):
#         # It's already a text, just return it.
#         return value
#     elif isinstance(value, bytes):
#         # It's a byte string, decode it.
#         return value.decode('utf-8')
#     else:
#         # It's not a string, convert it.
#         return six.text_type(value)
# 
# def string_to_text(value, deprecate_msg):
#     """
#     Return input string coverted to text string.
# 
#     If input is text, it is returned as is.
#     If input is binary, it is decoded using UTF-8 to text.
#     """
#     assert isinstance(value, (six.text_type, six.binary_type))
#     if isinstance(value, six.binary_type):
#         warnings.warn(deprecate_msg, DeprecationWarning)
#         value = value.decode('utf-8')
#     return value


# Path: openid/test/test_oidutil.py
import random
import string
import unittest
import warnings
import six
        import copy
from mock import sentinel
from testfixtures import ShouldWarn
from openid import oidutil
from openid.oidutil import force_text, string_to_text


        cases = [
            b'',
            b'x',
            b'\x00',
            b'\x01',
            b'\x00' * 100,
        ]
        if six.PY2:
            cases.append(b''.join(chr(i) for i in range(256)))
        else:
            assert six.PY3
            cases.append(bytes(i for i in range(256)))

        for s in cases:
            b64 = oidutil.toBase64(s)
            checkEncoded(b64)
            s_prime = oidutil.fromBase64(b64)
            assert s_prime == s, (s, b64, s_prime)

        # Randomized test
        for _ in range(50):
            n = random.randrange(2048)
            if six.PY2:
                s = b''.join(chr(random.randrange(256)) for i in range(n))
            else:
                assert six.PY3
                s = bytes(random.randrange(256) for i in range(n))
            b64 = oidutil.toBase64(s)
            checkEncoded(b64)

            s_prime = oidutil.fromBase64(b64)