# Path: pyxmpp2/exceptions.py
# class StringprepError(Error):
#     """Exception raised when string preparation results in error."""
#     pass
# 
# Path: pyxmpp2/sasl/saslprep.py
# SASLPREP = Profile(
#     unassigned = (stringprep.in_table_a1,),
#     mapping = (b1_mapping, c12_mapping),
#     normalization = nfkc,
#     prohibited = (  stringprep.in_table_c12, stringprep.in_table_c21,
#                     stringprep.in_table_c22, stringprep.in_table_c3,
#                     stringprep.in_table_c4, stringprep.in_table_c5,
#                     stringprep.in_table_c6, stringprep.in_table_c7,
#                     stringprep.in_table_c8, stringprep.in_table_c9 ),
#     bidi = True)
# 
# Path: pyxmpp2/test/_support.py
# def load_tests(loader, tests, pattern):
#     """Use default test list, just remove the classes which names start with
#     '_'."""
#     # pylint: disable=W0613
#     suite = filter_tests(tests)
#     return suite
# 
# def setup_logging():
#     """Set up logging for the tests.
# 
#     Log level used depends on number of '-v' in sys.argv
#     """
#     # pylint: disable=W0603
#     global logging_ready
#     if logging_ready:
#         return
#     if sys.argv.count("-v") > 2:
#         logging.basicConfig(level=logging.DEBUG)
#     elif sys.argv.count("-v") == 2:
#         logging.basicConfig(level=logging.INFO)
#     else:
#         logging.basicConfig(level=logging.ERROR)
#     logging_ready = True


import unittest
from pyxmpp2.exceptions import StringprepError
from pyxmpp2.sasl.saslprep import SASLPREP
from pyxmpp2.test._support import load_tests, setup_logging
#!/usr/bin/python -u
# -*- coding: UTF-8 -*-
# pylint: disable=C0111



class TestSASLprep(unittest.TestCase):
    # pylint: disable=R0903
    def test_rfc_examples(self):
        for input_, output in (
                                (u"I\u00ADX",   u"IX"),
                                (u"user",       u"user"),
                                (u"USER",       u"USER"),
                                (u"\u00AA",     u"a"),
                                (u"\u2168",     u"IX"),
                                ):
            result = SASLPREP.prepare(input_)
            self.assertEqual(result, output)
        for input_ in (u"\u0007", u"\u0627\u0031"):
            with self.assertRaises(StringprepError):

# Path: pyxmpp2/exceptions.py
# class StringprepError(Error):
#     """Exception raised when string preparation results in error."""
#     pass
# 
# Path: pyxmpp2/sasl/saslprep.py
# SASLPREP = Profile(
#     unassigned = (stringprep.in_table_a1,),
#     mapping = (b1_mapping, c12_mapping),
#     normalization = nfkc,
#     prohibited = (  stringprep.in_table_c12, stringprep.in_table_c21,
#                     stringprep.in_table_c22, stringprep.in_table_c3,
#                     stringprep.in_table_c4, stringprep.in_table_c5,
#                     stringprep.in_table_c6, stringprep.in_table_c7,
#                     stringprep.in_table_c8, stringprep.in_table_c9 ),
#     bidi = True)
# 
# Path: pyxmpp2/test/_support.py
# def load_tests(loader, tests, pattern):
#     """Use default test list, just remove the classes which names start with
#     '_'."""
#     # pylint: disable=W0613
#     suite = filter_tests(tests)
#     return suite
# 
# def setup_logging():
#     """Set up logging for the tests.
# 
#     Log level used depends on number of '-v' in sys.argv
#     """
#     # pylint: disable=W0603
#     global logging_ready
#     if logging_ready:
#         return
#     if sys.argv.count("-v") > 2:
#         logging.basicConfig(level=logging.DEBUG)
#     elif sys.argv.count("-v") == 2:
#         logging.basicConfig(level=logging.INFO)
#     else:
#         logging.basicConfig(level=logging.ERROR)
#     logging_ready = True


# Path: pyxmpp2/test/sasl_saslprep.py
import unittest
from pyxmpp2.exceptions import StringprepError
from pyxmpp2.sasl.saslprep import SASLPREP
from pyxmpp2.test._support import load_tests, setup_logging

#!/usr/bin/python -u
# -*- coding: UTF-8 -*-
# pylint: disable=C0111



class TestSASLprep(unittest.TestCase):
    # pylint: disable=R0903
    def test_rfc_examples(self):
        for input_, output in (
                                (u"I\u00ADX",   u"IX"),
                                (u"user",       u"user"),
                                (u"USER",       u"USER"),
                                (u"\u00AA",     u"a"),
                                (u"\u2168",     u"IX"),
                                ):
            result = SASLPREP.prepare(input_)
            self.assertEqual(result, output)
        for input_ in (u"\u0007", u"\u0627\u0031"):
            with self.assertRaises(StringprepError):

                SASLPREP.prepare(input_)