'Test using error exceptions with Iq stanzas.'

def testIqErrorException(self):

    def handle_iq(iq):
        raise XMPPError(condition='feature-not-implemented', text="We    don't    do    things    that    way    here.", etype='cancel', clear=False)
    self.stream_start()
    self.xmpp.register_handler(Callback('Test    Iq', MatchXPath(('{%s}iq/{test}query' % self.xmpp.default_ns)), handle_iq))
    self.recv('\n                                        <iq    type="get"    id="0">\n                                                <query    xmlns="test"    />\n                                        </iq>\n                                ')
    self.send('\n                                        <iq    type="error"    id="0">\n                                                <query    xmlns="test"    />\n                                                <error    type="cancel"    code="501">\n                                                        <feature-not-implemented\n                                                                        xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"    />\n                                                        <text    xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">\n                                                                We    don&apos;t    do    things    that    way    here.\n                                                        </text>\n                                                </error>\n                                        </iq>\n                                ', use_values=False)
