def test_simple_type_empty(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("simple_type", "schema"))

        simple_type_xpath = "/xs:schema/xs:simpleType"
        simple_type = xml_schema.xpath(simple_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("simple_type", "empty"))

        reload_data = get_xml_element_data(simple_type, xml_element)
        self.assertEqual(reload_data, "")
    def test_complex_type_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("complex_type", "schema"))

        complex_type_xpath = "/xs:schema/xs:complexType"
        complex_type = xml_schema.xpath(complex_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("complex_type", "filled"))

        reload_data = get_xml_element_data(complex_type, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))
    def test_element_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("element", "complex"))

        element_root_xpath = "/xs:schema/xs:element"
        element_root = xml_schema.xpath(element_root_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("element", "complex"))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))
    def test_element_xml_text(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("element", "simple"))

        element_root_xpath = "/xs:schema/xs:element"
        element_root = xml_schema.xpath(element_root_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("element", "simple"))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, "string")
    def test_attribute(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("attribute", "schema"))

        attribute_xpath = "/xs:schema/xs:element/xs:complexType/xs:attribute"
        attribute = xml_schema.xpath(attribute_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("attribute", "instance"))
        xml_element_attrib = xml_element.attrib["id"]

        reload_data = get_xml_element_data(attribute, xml_element_attrib)
        self.assertEqual(reload_data, "attr0")
Exemplo n.º 6
0
    def test_simple_type_empty(self):
        xml_schema = self.xml_element_data_handler.get_xsd(
            join('simple_type', 'schema'))

        simple_type_xpath = '/xs:schema/xs:simpleType'
        simple_type = xml_schema.xpath(simple_type_xpath,
                                       namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(
            join('simple_type', 'empty'))

        reload_data = get_xml_element_data(simple_type, xml_element)
        self.assertEqual(reload_data, "")
Exemplo n.º 7
0
    def test_element_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(
            join('element', 'complex'))

        element_root_xpath = '/xs:schema/xs:element'
        element_root = xml_schema.xpath(element_root_xpath,
                                        namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(
            join('element', 'complex'))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))
Exemplo n.º 8
0
    def test_element_xml_text(self):
        xml_schema = self.xml_element_data_handler.get_xsd(
            join('element', 'simple'))

        element_root_xpath = '/xs:schema/xs:element'
        element_root = xml_schema.xpath(element_root_xpath,
                                        namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(
            join('element', 'simple'))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, 'string')
Exemplo n.º 9
0
    def test_complex_type_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(
            join('complex_type', 'schema'))

        complex_type_xpath = '/xs:schema/xs:complexType'
        complex_type = xml_schema.xpath(complex_type_xpath,
                                        namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(
            join('complex_type', 'filled'))

        reload_data = get_xml_element_data(complex_type, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))
Exemplo n.º 10
0
    def test_attribute(self):
        xml_schema = self.xml_element_data_handler.get_xsd(
            join('attribute', 'schema'))

        attribute_xpath = '/xs:schema/xs:element/xs:complexType/xs:attribute'
        attribute = xml_schema.xpath(attribute_xpath,
                                     namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(
            join('attribute', 'instance'))
        xml_element_attrib = xml_element.attrib['id']

        reload_data = get_xml_element_data(attribute, xml_element_attrib)
        self.assertEqual(reload_data, 'attr0')