def test_element_lxml_name_with_namespace(string_type): surname_elem = Element('Surname', element_type=string_type) surname_elem.namespace = 'foo.bar.com' namespaces = {'foo.bar.com': 'f'} assert surname_elem.lxml_name(namespaces) == 'f:Surname'
def test_element_to_lxml_element_must_return_expected_tag_with_namespace( string_type, lxml_root): el = Element('Surname', element_type=string_type) el.namespace = 'http://foo.com.br/xmlschema' el.to_lxml_element(lxml_root) result = et.tostring(lxml_root).decode() expected = ( '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">' '<xsl:element name="Surname" namespace="http://foo.com.br/xmlschema">autogenerated</xsl:element>' '</xsl:stylesheet>') assert result == expected