def test_remote_files(): this_path = current_path / "cwl" / "misc" / "wf-remote-steps.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) # Refers to an earlier commit hov = doc.hover(Position(13, 32)) assert "class:" in hov.contents.value # Non existent commit hov = doc.hover(Position(19, 32)) assert hov.contents.value == "```\n\n```"
def test_basic_JS(): path = current_path / "cwl" / "misc" / "clt1.cwl" doc = load(doc_path=path, type_dicts=type_dicts) hov = doc.hover(loc=Position(7, 25)) assert isinstance(hov.contents.value, str) assert hov.contents.value.startswith("```\nA_") hov = doc.hover(loc=Position(10, 19)) assert isinstance(hov.contents.value, str) assert "outdirSize" in hov.contents.value
def test_port_completer(): this_path = current_path / "cwl" / "misc" / "wf-port-completer.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) cmpl = doc.completion(Position(10, 14)) # Not a list assert "in1" in [c.label for c in cmpl] cmpl = doc.completion(Position(23, 11)) # Is a list assert "out1" in [c.label for c in cmpl] cmpl = doc.completion(Position(24, 9)) # Is a list assert "in1" in [c.label for c in cmpl]
def test_schemadef_import(): this_path = current_path / "cwl" / "misc" / "cl-schemadef-import.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) assert len(doc.problems) == 0 cmpl = doc.completion(Position(12, 21)) assert "cl-schemadef-import.cwl" in [c.label for c in cmpl] # The completer should look for all files in the current directory cmpl = doc.completion(Position(4, 11)) assert "./paired_end_record.yml#paired_end_options" in [ c.label for c in cmpl ]
def test_implicit_inputs(): this_path = current_path / "cwl" / "misc" / "wf-when-input.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) assert len(doc.problems) == 0 cmpl = doc.completion(Position(12, 8)) assert "new_input" in [c.label for c in cmpl]
def test_definition(): doc = load(doc_path=path, type_dicts=type_dicts) linked_uri = pathlib.Path(current_path / "cwl" / "ebi" / "utils" / "concatenate.cwl") doc_def_loc = doc.definition(loc=Position(50, 20)) assert isinstance(doc_def_loc, Location) assert doc_def_loc.uri == linked_uri.as_uri()
def test_docs_on_hover(): this_path = current_path / "cwl" / "misc" / "wf-when-input.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) hov = doc.hover(Position(10, 6)) assert "Sibling" in hov.contents.value assert hov.contents.kind == "markdown"
def test_plain_text_include(): this_path = current_path / "cwl" / "misc" / "cl-include-text.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) assert len(doc.problems) == 0 hov = doc.hover(Position(9, 21)) assert "We hold" in hov.contents.value
def test_requirements_completion(): this_path = current_path / "cwl" / "misc" / "cl-hints-dict.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) cmpl = doc.completion(Position(12, 8)) assert "dockerLoad" in [c.label for c in cmpl] this_path = current_path / "cwl" / "misc" / "cl-hints-list.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) cmpl = doc.completion(Position(12, 8)) assert "dockerImport" in [c.label for c in cmpl] this_path = current_path / "cwl" / "misc" / "cl-hints-dict-start.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) cmpl = doc.completion(Position(12, 5)) assert "dockerLoad" in [c.label for c in cmpl]
def test_hints_imports(): this_path = current_path / "cwl" / "misc" / "cl-hints-import.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) assert len(doc.problems) == 1 missing_error = next(p for p in doc.problems if p.range.start.line == 4) assert missing_error.message.startswith("Missing document:") cmpl = doc.completion(Position(4, 20)) assert "cl-schemadef-import.cwl" in [c.label for c in cmpl]
def test_v1_1_runtime(): # No exitcode in runtime in v1.0 ever path = current_path / "cwl" / "misc" / "clt1.cwl" doc = load(doc_path=path, type_dicts=type_dicts) hov = doc.hover(loc=Position(10, 19)) assert "exitCode" not in hov.contents.value hov = doc.hover(loc=Position(17, 33)) assert "exitCode" not in hov.contents.value # Exitcode in runtime in v1.1 when in output path = current_path / "cwl" / "misc" / "clt2.cwl" doc = load(doc_path=path, type_dicts=type_dicts) hov = doc.hover(loc=Position(24, 20)) assert "exitCode" not in hov.contents.value hov = doc.hover(loc=Position(31, 34)) assert "exitCode" in hov.contents.value
def test_requirement_sub_completion(): this_path = current_path / "cwl" / "ebi" / "workflows" / "InterProScan-v5-chunked-wf.cwl" doc = load(doc_path=this_path, type_dicts=type_dicts) cmpl = doc.completion(Position(8, 10)) assert "InlineJavascriptRequirement" in [c.label for c in cmpl]
def test_requirement_completion(): doc = load(doc_path=path, type_dicts=type_dicts) cmpl = doc.completion(Position(8, 16)) assert "InlineJavascriptRequirement" in [c.label for c in cmpl]
def test_step_input_completion(): doc = load(doc_path=path, type_dicts=type_dicts) cmpl = doc.completion(Position(37, 38)) assert "covariance_models" in [c.label for c in cmpl]
def test_type_completion(): doc = load(doc_path=path, type_dicts=type_dicts) cmpl = doc.completion(Position(14, 11)) assert "string" in [c.label for c in cmpl]
def test_record_field_completion(): doc = load(doc_path=path, type_dicts=type_dicts) cmpl = doc.completion(Position(7, 0)) assert "doc" in [c.label for c in cmpl]