def test_startendElement_groupfieldattributestrategy(self):
        fun = sys._getframe().f_code.co_name
        print("Run: %s.%s() " % (self.__class__.__name__, fun))

        el = ComponentHandler()
        self.assertEqual(el.datasources, {})
        name = "field"
        aname = "attribute"
        attr = {"name2": "mydt"}
        ds = "extr_mot1"
        ds2 = "extr_mot2"
        self.assertEqual(el.startElement("group", attr), None)
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(el.characters("$datasources.%s" % ds), None)
        self.assertEqual(el.startElement(aname, attr), None)
        self.assertEqual(el.characters("$datasources.%s" % ds2), None)
        self.assertEqual(el.endElement(name), None)
        self.assertEqual(el.startElement("strategy", attr), None)
        self.assertEqual(el.characters("$datasources.my"), None)
        self.assertEqual(el.endElement("strategy"), None)
        self.assertEqual(el.endElement(name), None)
        self.assertEqual(el.datasources, {
            'extr_mot1': '__FROM_DB__',
            'extr_mot2': '__FROM_DB__'
        })
        self.assertEqual(el.endElement("group"), None)
    def test_startElement(self):
        fun = sys._getframe().f_code.co_name
        print("Run: %s.%s() " % (self.__class__.__name__, fun))

        el = ComponentHandler()
        self.assertEqual(el.datasources, {})
        name = "datasource2"
        attr = {"name": "mydt"}
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(el.datasources, {})

        name = "datasource"
        attr = {"name2": "mydt"}
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(el.datasources, {'__unnamed__0': ''})

        name = "datasource"
        attr = {"name": "myds"}
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(el.datasources, {'__unnamed__0': '', 'myds': ''})

        name = "datasource"
        attr = {"name": "myds2", "type": "TANGO"}
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(el.datasources, {
            '__unnamed__0': '',
            'myds2': 'TANGO',
            'myds': ''
        })

        name = "datasource"
        attr = {"type": "CLIENT"}
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(
            el.datasources, {
                '__unnamed__0': '',
                '__unnamed__1': 'CLIENT',
                'myds2': 'TANGO',
                'myds': ''
            })
    def test_startendElement_group(self):
        fun = sys._getframe().f_code.co_name
        print("Run: %s.%s() " % (self.__class__.__name__, fun))

        el = ComponentHandler()
        self.assertEqual(el.datasources, {})
        name = "group"
        attr = {"name2": "mydt"}
        ds = "extr_mot1"
        self.assertEqual(el.startElement(name, attr), None)
        self.assertEqual(el.characters("$datasources.%s" % ds), None)
        self.assertEqual(el.endElement(name), None)
        self.assertEqual(el.datasources, {})