def test_index_descriptors(fx_adhoc_element_type): AdhocElement, AdhocTextElement = fx_adhoc_element_type assert not hasattr(AdhocTextElement, '__xmlns_set__') assert not hasattr(AdhocTextElement, '__child_tags__') assert not hasattr(AdhocTextElement, '__attributes__') assert not hasattr(AdhocTextElement, '__content_tag__') index_descriptors(AdhocTextElement) assert AdhocTextElement.__content_tag__ assert not hasattr(AdhocElement, '__xmlns_set__') assert not hasattr(AdhocElement, '__child_tags__') assert not hasattr(AdhocElement, '__attributes__') assert not hasattr(AdhocElement, '__content_tag__') index_descriptors(AdhocElement) assert len(AdhocElement.__xmlns_set__) == 1 assert len(AdhocElement.__child_tags__) == 3 assert len(AdhocElement.__attributes__) == 1 assert not AdhocElement.__content_tag__
def test_attribute_descriptor_conflict(): with raises(DescriptorConflictError): index_descriptors(AttrDescriptorConflictElement)
def test_child_descriptor_conflict(): with raises(DescriptorConflictError): index_descriptors(ChildDescriptorConflictElement)
def test_content_descriptor_conflict(): with raises(DescriptorConflictError): index_descriptors(ContentDescriptorConflictElement)