# Path: pyxmpp/xmlextra.py
# COMMON_NS = "http://pyxmpp.jajcus.net/xmlns/common"
# class StreamHandler:
#     class error(Exception):
#     class _SAXCallback(libxml2.SAXCallback):
#     class _PythonReader:
# class StreamReader:
#     def __init__(self):
#     def _stream_start(self,_doc):
#     def _stream_end(self,_doc):
#     def _stanza(self,_doc,_node):
#     def stream_start(self,doc):
#     def stream_end(self,doc):
#     def stanza(self, _unused, node):
#     def error(self,descr):
#     def warning(self,desc):
#     def replace_ns(node, old_ns,new_ns):
#     def _escape(data):
#         def __init__(self, handler):
#         def cdataBlock(self, data):
#         def characters(self, data):
#         def comment(self, content):
#         def endDocument(self):
#         def endElement(self, tag):
#         def error(self, msg):
#         def reference(self, name):
#         def startDocument(self):
#         def startElement(self, tag, attrs):
#         def warning(self):
#         def __init__(self,handler):
#         def feed(self, data):
#     def _get_ns(node):
#     def replace_ns(node, old_ns, new_ns):
# def get_node_ns(xmlnode):
# def get_node_ns_uri(xmlnode):
# def xml_node_iter(nodelist):
# def xml_element_iter(nodelist):
# def xml_element_ns_iter(nodelist, ns_uri):
# def remove_evil_characters(s):
# def safe_serialize(xmlnode):
#     def __init__(self,handler):
#     def doc(self):
#     def feed(self,s):
# 
# Path: pyxmpp/jid.py
# def are_domains_equal(a,b):
#     def __new__(cls,node_or_jid=None,domain=None,resource=None,check=True):
#     def __setattr__(self,name,value):
#     def __from_unicode(self,s,check=True):
#     def __set_node(self,s):
#     def __set_domain(self,s):
#     def __set_resource(self,s):
#     def __str__(self):
#     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 __cmp__(self,other):
#     def __hash__(self):
# class JID(object):
# 
# Path: pyxmpp/xmppstringprep.py
# class LookupFunction:
# class LookupTable:
# class Profile:
#     def __init__(self,function):
#     def __init__(self,singles,ranges):
#     def lookup(self,c):
# def b1_mapping(uc):
# def nfkc(data):
#     def __init__(self,unassigned,mapping,normalization,prohibited,bidi=1):
#     def prepare(self,data):
#     def prepare_query(self,s):
#     def map(self,s):
#     def prohibit(self,s):
#     def check_unassigned(self,s):
#     def check_bidi(self,s):
# def set_stringprep_cache_size(size):
# A_1=LookupFunction(stringprep.in_table_a1)
# B_1=LookupFunction(b1_mapping)
# B_2=LookupFunction(stringprep.map_table_b2)
# B_3=LookupFunction(stringprep.map_table_b3)
# C_1_1=LookupFunction(stringprep.in_table_c11)
# C_1_2=LookupFunction(stringprep.in_table_c12)
# C_2_1=LookupFunction(stringprep.in_table_c21)
# C_2_2=LookupFunction(stringprep.in_table_c22)
# C_3=LookupFunction(stringprep.in_table_c3)
# C_4=LookupFunction(stringprep.in_table_c4)
# C_5=LookupFunction(stringprep.in_table_c5)
# C_6=LookupFunction(stringprep.in_table_c6)
# C_7=LookupFunction(stringprep.in_table_c7)
# C_8=LookupFunction(stringprep.in_table_c8)
# C_9=LookupFunction(stringprep.in_table_c9)
# D_1=LookupFunction(stringprep.in_table_d1)
# D_2=LookupFunction(stringprep.in_table_d2)


import unittest
import libxml2
from pyxmpp import xmlextra
from pyxmpp.jid import JID,JIDError
from pyxmpp import xmppstringprep
        return "<EventTemplate %r at %r: %r>" % (self.event, self.offset, self.xml.getRootElement().serialize())

class StreamHandler(xmlextra.StreamHandler):
    def __init__(self, test_case):
        self.test_case = test_case
    def stream_start(self, doc):
        self.test_case.event("start", doc.getRootElement())
    def stream_end(self, doc):
        self.test_case.event("end", None)
    def stanza(self, doc, node):
        self.test_case.event("node", node)

expected_events = []
whole_stream = None

def load_expected_events():
    for l in file("data/stream_info.txt"):
        if l.startswith("#"):
            continue
        l=l.strip()
        expected_events.append(EventTemplate(l))

def load_whole_stream():
    global whole_stream
    whole_stream = libxml2.parseFile("data/stream.xml")

class TestStreamReader(unittest.TestCase):
    def setUp(self):
        self.expected_events = list(expected_events)
        self.handler = StreamHandler(self)

# Path: pyxmpp/xmlextra.py
# COMMON_NS = "http://pyxmpp.jajcus.net/xmlns/common"
# class StreamHandler:
#     class error(Exception):
#     class _SAXCallback(libxml2.SAXCallback):
#     class _PythonReader:
# class StreamReader:
#     def __init__(self):
#     def _stream_start(self,_doc):
#     def _stream_end(self,_doc):
#     def _stanza(self,_doc,_node):
#     def stream_start(self,doc):
#     def stream_end(self,doc):
#     def stanza(self, _unused, node):
#     def error(self,descr):
#     def warning(self,desc):
#     def replace_ns(node, old_ns,new_ns):
#     def _escape(data):
#         def __init__(self, handler):
#         def cdataBlock(self, data):
#         def characters(self, data):
#         def comment(self, content):
#         def endDocument(self):
#         def endElement(self, tag):
#         def error(self, msg):
#         def reference(self, name):
#         def startDocument(self):
#         def startElement(self, tag, attrs):
#         def warning(self):
#         def __init__(self,handler):
#         def feed(self, data):
#     def _get_ns(node):
#     def replace_ns(node, old_ns, new_ns):
# def get_node_ns(xmlnode):
# def get_node_ns_uri(xmlnode):
# def xml_node_iter(nodelist):
# def xml_element_iter(nodelist):
# def xml_element_ns_iter(nodelist, ns_uri):
# def remove_evil_characters(s):
# def safe_serialize(xmlnode):
#     def __init__(self,handler):
#     def doc(self):
#     def feed(self,s):
# 
# Path: pyxmpp/jid.py
# def are_domains_equal(a,b):
#     def __new__(cls,node_or_jid=None,domain=None,resource=None,check=True):
#     def __setattr__(self,name,value):
#     def __from_unicode(self,s,check=True):
#     def __set_node(self,s):
#     def __set_domain(self,s):
#     def __set_resource(self,s):
#     def __str__(self):
#     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 __cmp__(self,other):
#     def __hash__(self):
# class JID(object):
# 
# Path: pyxmpp/xmppstringprep.py
# class LookupFunction:
# class LookupTable:
# class Profile:
#     def __init__(self,function):
#     def __init__(self,singles,ranges):
#     def lookup(self,c):
# def b1_mapping(uc):
# def nfkc(data):
#     def __init__(self,unassigned,mapping,normalization,prohibited,bidi=1):
#     def prepare(self,data):
#     def prepare_query(self,s):
#     def map(self,s):
#     def prohibit(self,s):
#     def check_unassigned(self,s):
#     def check_bidi(self,s):
# def set_stringprep_cache_size(size):
# A_1=LookupFunction(stringprep.in_table_a1)
# B_1=LookupFunction(b1_mapping)
# B_2=LookupFunction(stringprep.map_table_b2)
# B_3=LookupFunction(stringprep.map_table_b3)
# C_1_1=LookupFunction(stringprep.in_table_c11)
# C_1_2=LookupFunction(stringprep.in_table_c12)
# C_2_1=LookupFunction(stringprep.in_table_c21)
# C_2_2=LookupFunction(stringprep.in_table_c22)
# C_3=LookupFunction(stringprep.in_table_c3)
# C_4=LookupFunction(stringprep.in_table_c4)
# C_5=LookupFunction(stringprep.in_table_c5)
# C_6=LookupFunction(stringprep.in_table_c6)
# C_7=LookupFunction(stringprep.in_table_c7)
# C_8=LookupFunction(stringprep.in_table_c8)
# C_9=LookupFunction(stringprep.in_table_c9)
# D_1=LookupFunction(stringprep.in_table_d1)
# D_2=LookupFunction(stringprep.in_table_d2)


# Path: tests/stream_reader.py
import unittest
import libxml2
from pyxmpp import xmlextra
from pyxmpp.jid import JID,JIDError
from pyxmpp import xmppstringprep

        return "<EventTemplate %r at %r: %r>" % (self.event, self.offset, self.xml.getRootElement().serialize())

class StreamHandler(xmlextra.StreamHandler):
    def __init__(self, test_case):
        self.test_case = test_case
    def stream_start(self, doc):
        self.test_case.event("start", doc.getRootElement())
    def stream_end(self, doc):
        self.test_case.event("end", None)
    def stanza(self, doc, node):
        self.test_case.event("node", node)

expected_events = []
whole_stream = None

def load_expected_events():
    for l in file("data/stream_info.txt"):
        if l.startswith("#"):
            continue
        l=l.strip()
        expected_events.append(EventTemplate(l))

def load_whole_stream():
    global whole_stream
    whole_stream = libxml2.parseFile("data/stream.xml")

class TestStreamReader(unittest.TestCase):
    def setUp(self):
        self.expected_events = list(expected_events)
        self.handler = StreamHandler(self)

        self.reader = xmlextra.StreamReader(self.handler)