'Testing using is_extension.'

def testExtension(self):

    class TestStanza(ElementBase, ):
        name = 'foo'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
    class TestExtension(ElementBase, ):
        name = 'extended'
        namespace = 'foo'
        plugin_attrib = name
        interfaces = set((name,))
        is_extension = True
        def set_extended(self, value):
            self.xml.text = value
        def get_extended(self):
            return self.xml.text
        def del_extended(self):
            self.parent().xml.remove(self.xml)
    register_stanza_plugin(TestStanza, TestExtension)
    stanza = TestStanza()
    stanza['extended'] = 'testing'
    self.check(stanza, '\n                                        <foo    xmlns="foo">\n                                                <extended>testing</extended>\n                                        </foo>\n                                ')
    self.failUnless((stanza['extended'] == 'testing'), 'Could    not    retrieve    stanza    extension    value.')
    del stanza['extended']
    self.check(stanza, '\n                                        <foo    xmlns="foo"    />\n                                ')
