# Path: pyxmpp2/jid.py
# GOOD_OUTER = u"[^\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F-]"
# GOOD_INNER = u"[^\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]"
# STD3_LABEL_RE = re.compile(u"^{0}({1}*{0})?$".format(GOOD_OUTER, GOOD_INNER))
# UNICODE_DOT_RE = re.compile(u"[\u3002\uFF0E\uFF61]")
# def are_domains_equal(domain1, domain2):
# def _validate_ip_address(family, address):
#     def __new__(cls, local_or_jid = None, domain = None, resource = None,
#                                                                 check = True):
#     def __setattr__(self, name, value):
#     def __attribute_declarations__(self):
#     def __from_unicode(cls, data, check = True):
#     def __prepare_local(data):
#     def __prepare_domain(data):
#     def __prepare_resource(data):
#     def __unicode__(self):
#     def __repr__(self):
#     def as_utf8(self):
#     def as_string(self):
#     def as_unicode(self):
#     def bare(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __lt__(self, other):
#     def __gt__(self, other):
#     def __le__(self, other):
#     def __ge__(self, other):
#     def __hash__(self):
# class JID(object):
# 
# Path: pyxmpp2/xmppstringprep.py
# def b1_mapping(char):
# def c12_mapping(char):
# def nfkc(data):
#     def __init__(self, unassigned, mapping, normalization, prohibited,
#                                                                 bidi = True):
#     def prepare(self, data):
#     def prepare_query(self, data):
#     def map(self, data):
#     def prohibit(self, data):
#     def check_unassigned(self, data):
#     def check_bidi(data):
# def set_stringprep_cache_size(size):
# class Profile(object):
# NODEPREP_PROHIBITED = set([u'"', u'&', u"'", u"/", u":", u"<", u">", u"@"])
# NODEPREP = Profile(
#     unassigned = (stringprep.in_table_a1,),
#     mapping = (b1_mapping, stringprep.map_table_b2),
#     normalization = nfkc,
#     prohibited = (  stringprep.in_table_c11, 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,
#                     lambda x: x in NODEPREP_PROHIBITED ),
#     bidi = True)
# RESOURCEPREP = Profile(
#     unassigned = (stringprep.in_table_a1,),
#     mapping = (b1_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 sys
import unittest
import logging
        import weakref
from pyxmpp2.jid import JID, JIDError
from pyxmpp2 import xmppstringprep
from pyxmpp2.test._support import load_tests, setup_logging
            logging.debug(" checking {0!r}...".format(jid))
            jid = JID(jid)
            jtuple = (jid.local, jid.domain, jid.resource)
            self.assertEqual(jtuple, expected_tuple)
    def test_jid_from_tuple(self):
        for (local, domain, resource), jid in VALID_TUPLES:
            logging.debug(" checking {0!r}...".format(jid))
            j = JID(local, domain, resource)
            self.assertEqual(unicode(j), jid)
    def test_invalid_jids(self):
        for jid in INVALID_JIDS:
            logging.debug(" checking {0!r}...".format(jid))
            with self.assertRaises(JIDError):
                jid = JID(jid)
                logging.debug("   got: {0!r}".format(jid))
    def test_comparision(self):
        for expr in COMPARISIONS_TRUE:
            result = eval(expr)
            self.assertTrue(result, 'Expression %r gave: %r' % (expr, result))
        for expr in COMPARISIONS_FALSE:
            result = eval(expr)
            self.assertFalse(result, 'Expression %r gave: %r' % (expr, result))

class TestUncachedJID(TestJID):
    def setUp(self):
        # pylint: disable=W0404,W0212
        JID.cache = weakref.WeakValueDictionary()
        self.saved_stringprep_cache_size = xmppstringprep._stringprep_cache_size
        xmppstringprep.set_stringprep_cache_size(0)
    def tearDown(self):

# Path: pyxmpp2/jid.py
# GOOD_OUTER = u"[^\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F-]"
# GOOD_INNER = u"[^\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]"
# STD3_LABEL_RE = re.compile(u"^{0}({1}*{0})?$".format(GOOD_OUTER, GOOD_INNER))
# UNICODE_DOT_RE = re.compile(u"[\u3002\uFF0E\uFF61]")
# def are_domains_equal(domain1, domain2):
# def _validate_ip_address(family, address):
#     def __new__(cls, local_or_jid = None, domain = None, resource = None,
#                                                                 check = True):
#     def __setattr__(self, name, value):
#     def __attribute_declarations__(self):
#     def __from_unicode(cls, data, check = True):
#     def __prepare_local(data):
#     def __prepare_domain(data):
#     def __prepare_resource(data):
#     def __unicode__(self):
#     def __repr__(self):
#     def as_utf8(self):
#     def as_string(self):
#     def as_unicode(self):
#     def bare(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __lt__(self, other):
#     def __gt__(self, other):
#     def __le__(self, other):
#     def __ge__(self, other):
#     def __hash__(self):
# class JID(object):
# 
# Path: pyxmpp2/xmppstringprep.py
# def b1_mapping(char):
# def c12_mapping(char):
# def nfkc(data):
#     def __init__(self, unassigned, mapping, normalization, prohibited,
#                                                                 bidi = True):
#     def prepare(self, data):
#     def prepare_query(self, data):
#     def map(self, data):
#     def prohibit(self, data):
#     def check_unassigned(self, data):
#     def check_bidi(data):
# def set_stringprep_cache_size(size):
# class Profile(object):
# NODEPREP_PROHIBITED = set([u'"', u'&', u"'", u"/", u":", u"<", u">", u"@"])
# NODEPREP = Profile(
#     unassigned = (stringprep.in_table_a1,),
#     mapping = (b1_mapping, stringprep.map_table_b2),
#     normalization = nfkc,
#     prohibited = (  stringprep.in_table_c11, 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,
#                     lambda x: x in NODEPREP_PROHIBITED ),
#     bidi = True)
# RESOURCEPREP = Profile(
#     unassigned = (stringprep.in_table_a1,),
#     mapping = (b1_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/jid.py
import sys
import unittest
import logging
        import weakref
from pyxmpp2.jid import JID, JIDError
from pyxmpp2 import xmppstringprep
from pyxmpp2.test._support import load_tests, setup_logging

            logging.debug(" checking {0!r}...".format(jid))
            jid = JID(jid)
            jtuple = (jid.local, jid.domain, jid.resource)
            self.assertEqual(jtuple, expected_tuple)
    def test_jid_from_tuple(self):
        for (local, domain, resource), jid in VALID_TUPLES:
            logging.debug(" checking {0!r}...".format(jid))
            j = JID(local, domain, resource)
            self.assertEqual(unicode(j), jid)
    def test_invalid_jids(self):
        for jid in INVALID_JIDS:
            logging.debug(" checking {0!r}...".format(jid))
            with self.assertRaises(JIDError):
                jid = JID(jid)
                logging.debug("   got: {0!r}".format(jid))
    def test_comparision(self):
        for expr in COMPARISIONS_TRUE:
            result = eval(expr)
            self.assertTrue(result, 'Expression %r gave: %r' % (expr, result))
        for expr in COMPARISIONS_FALSE:
            result = eval(expr)
            self.assertFalse(result, 'Expression %r gave: %r' % (expr, result))

class TestUncachedJID(TestJID):
    def setUp(self):
        # pylint: disable=W0404,W0212
        JID.cache = weakref.WeakValueDictionary()
        self.saved_stringprep_cache_size = xmppstringprep._stringprep_cache_size
        xmppstringprep.set_stringprep_cache_size(0)
    def tearDown(self):

        xmppstringprep.set_stringprep_cache_size(