def testCannotConvert(self): x = ["0.0.0", "1.1.0"] for i in x: for j in x: if i == j: continue self.assertFalse(can_convert_nexson_forms(i, j))
def testCanConvert(self): x = ["0.0.0", "1.0.0"] for i in x: for j in x: self.assertTrue(can_convert_nexson_forms(i, j))
output_choices = ['ot:nexson', 'nexson', 'nexml', 'input', 'provenance'] if output not in output_choices: raise HTTP( 400, 'The "output" should be one of: "{c}"'.format( c='", "'.join(output_choices))) try: working_dir = get_external_proc_dir_for_upload(request, '2nexml', unique_id, is_upload) except Exception, x: raise HTTP(404) if working_dir is None or (not os.path.exists(working_dir)): raise HTTP(404) _LOG.debug('created ' + working_dir) NEXSON_VERSION = request.vars.nexml2json or '0.0.0' if output.endswith('nexson') and (not can_convert_nexson_forms( 'nexml', NEXSON_VERSION)): raise HTTP(400, 'The "nexml2json" argument be "0.0", "1.0", or "1.2"') input_choices = ['nexus', 'newick', 'nexml'] first_tree_available_trees_id = 0 if is_upload: if 'inputFormat' not in request.vars: raise HTTP(400, T('The "inputFormat" argument must be supplied.')) inp_format = request.vars.inputFormat or 'nexus' inp_format = inp_format.lower() if inp_format not in input_choices: raise HTTP( 400, 'inputFormat should be one of: "{c}"'.format( c='", "'.join(input_choices))) if output not in ['ot:nexson', 'nexson']: raise HTTP(
if output == 'ot%3anexson': # handle unwanted encoding (happens if file submitted) output = 'ot:nexson' output_choices = ['ot:nexson', 'nexson', 'nexml', 'input', 'provenance'] if output not in output_choices: raise HTTP(400, 'The "output" should be one of: "{c}"'.format(c='", "'.join(output_choices))) try: working_dir = get_external_proc_dir_for_upload(request, '2nexml', unique_id, is_upload) except Exception, x: raise HTTP(404) if working_dir is None or (not os.path.exists(working_dir)): raise HTTP(404) _LOG.debug('created ' + working_dir) NEXSON_VERSION = request.vars.nexml2json or '0.0.0' if output.endswith('nexson') and (not can_convert_nexson_forms('nexml', NEXSON_VERSION)): raise HTTP(400, 'The "nexml2json" argument be "0.0", "1.0", or "1.2"') input_choices = ['nexus', 'newick', 'nexml'] first_tree_available_trees_id = 0 if is_upload: if 'inputFormat' not in request.vars: raise HTTP(400, T('The "inputFormat" argument must be supplied.')) inp_format = request.vars.inputFormat or 'nexus' inp_format = inp_format.lower() if inp_format not in input_choices: raise HTTP(400, 'inputFormat should be one of: "{c}"'.format(c='", "'.join(input_choices))) if output not in ['ot:nexson', 'nexson']: raise HTTP(400, 'The "output" argument should be "nexson" in the first call with each "uploadId"') orig_args['uploadId'] = unique_id orig_args['inputFormat'] = inp_format
if output == "ot%3anexson": # handle unwanted encoding (happens if file submitted) output = "ot:nexson" output_choices = ["ot:nexson", "nexson", "nexml", "input", "provenance"] if output not in output_choices: raise HTTP(400, 'The "output" should be one of: "{c}"'.format(c='", "'.join(output_choices))) try: working_dir = get_external_proc_dir_for_upload(request, "2nexml", unique_id, is_upload) except Exception, x: raise HTTP(404) if working_dir is None or (not os.path.exists(working_dir)): raise HTTP(404) _LOG.debug("created " + working_dir) NEXSON_VERSION = request.vars.nexml2json or "0.0.0" if output.endswith("nexson") and (not can_convert_nexson_forms("nexml", NEXSON_VERSION)): raise HTTP(400, 'The "nexml2json" argument be "0.0", "1.0", or "1.2"') input_choices = ["nexus", "newick", "nexml"] first_tree_available_trees_id = 0 if is_upload: if "inputFormat" not in request.vars: raise HTTP(400, T('The "inputFormat" argument must be supplied.')) inp_format = request.vars.inputFormat or "nexus" inp_format = inp_format.lower() if inp_format not in input_choices: raise HTTP(400, 'inputFormat should be one of: "{c}"'.format(c='", "'.join(input_choices))) if output not in ["ot:nexson", "nexson"]: raise HTTP(400, 'The "output" argument should be "nexson" in the first call with each "uploadId"') orig_args["uploadId"] = unique_id orig_args["inputFormat"] = inp_format