def remove_response_property(xml_root):
    """Removes response properties if exist."""
    if xml_root.tag == "testsuites":
        properties = xml_root.find("properties")
        resp_properties = []
        for prop in properties:
            prop_name = prop.get("name", "")
            if "polarion-response-" in prop_name:
                resp_properties.append(prop)
        for resp_property in resp_properties:
            properties.remove(resp_property)
    elif xml_root.tag in ("testcases", "requirements"):
        resp_properties = xml_root.find("response-properties")
        if resp_properties is not None:
            xml_root.remove(resp_properties)
    else:
        raise Dump2PolarionException(_NOT_EXPECTED_FORMAT_MSG)
def remove_response_property ( xml_root ) : if xml_root . tag == "testsuites" : properties = xml_root . find ( "properties" ) resp_properties = [ ] for prop in properties : prop_name = prop . get ( "name" , "" ) if "polarion-response-" in prop_name : resp_properties . append ( prop ) for resp_property in resp_properties : properties . remove ( resp_property ) elif xml_root . tag in ( "testcases" , "requirements" ) : resp_properties = xml_root . find ( "response-properties" ) if resp_properties is not None : xml_root . remove ( resp_properties ) else : raise Dump2PolarionException ( _NOT_EXPECTED_FORMAT_MSG )
Removes response properties if exist.