|
| 1 | +from __future__ import absolute_import |
| 2 | +import unittest |
| 3 | + |
| 4 | +from six import StringIO |
| 5 | +from cwltool.main import main |
| 6 | + |
| 7 | +class RDF_Print(unittest.TestCase): |
| 8 | + |
| 9 | + def test_rdf_print(self): |
| 10 | + self.maxDiff = None |
| 11 | + |
| 12 | + expected_output = """@prefix CommandLineBinding: <https://w3id.org/cwl/cwl#CommandLineBinding/> . |
| 13 | +@prefix CommandLineTool: <https://w3id.org/cwl/cwl#CommandLineTool/> . |
| 14 | +@prefix CommandOutputBinding: <https://w3id.org/cwl/cwl#CommandOutputBinding/> . |
| 15 | +@prefix Dirent: <https://w3id.org/cwl/cwl#Dirent/> . |
| 16 | +@prefix DockerRequirement: <https://w3id.org/cwl/cwl#DockerRequirement/> . |
| 17 | +@prefix EnvVarRequirement: <https://w3id.org/cwl/cwl#EnvVarRequirement/> . |
| 18 | +@prefix EnvironmentDef: <https://w3id.org/cwl/cwl#EnvironmentDef/> . |
| 19 | +@prefix ExpressionTool: <https://w3id.org/cwl/cwl#ExpressionTool/> . |
| 20 | +@prefix File: <https://w3id.org/cwl/cwl#File/> . |
| 21 | +@prefix InlineJavascriptRequirement: <https://w3id.org/cwl/cwl#InlineJavascriptRequirement/> . |
| 22 | +@prefix LinkMergeMethod: <https://w3id.org/cwl/cwl#LinkMergeMethod/> . |
| 23 | +@prefix Parameter: <https://w3id.org/cwl/cwl#Parameter/> . |
| 24 | +@prefix ResourceRequirement: <https://w3id.org/cwl/cwl#ResourceRequirement/> . |
| 25 | +@prefix ScatterMethod: <https://w3id.org/cwl/cwl#ScatterMethod/> . |
| 26 | +@prefix SchemaDefRequirement: <https://w3id.org/cwl/cwl#SchemaDefRequirement/> . |
| 27 | +@prefix SoftwarePackage: <https://w3id.org/cwl/cwl#SoftwarePackage/> . |
| 28 | +@prefix SoftwareRequirement: <https://w3id.org/cwl/cwl#SoftwareRequirement/> . |
| 29 | +@prefix Workflow: <https://w3id.org/cwl/cwl#Workflow/> . |
| 30 | +@prefix cwl: <https://w3id.org/cwl/cwl#> . |
| 31 | +@prefix ns1: <rdfs:> . |
| 32 | +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
| 33 | +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
| 34 | +@prefix sld: <https://w3id.org/cwl/salad#> . |
| 35 | +@prefix xml: <http://www.w3.org/XML/1998/namespace> . |
| 36 | +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
| 37 | +
|
| 38 | +<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl> a cwl:Workflow ; |
| 39 | + Workflow:steps <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0> ; |
| 40 | + cwl:cwlVersion cwl:v1.0 ; |
| 41 | + cwl:outputs <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#response> ; |
| 42 | + ns1:comment "Outputs a message using echo" ; |
| 43 | + ns1:label "Hello World" . |
| 44 | +
|
| 45 | +<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#response> cwl:outputSource <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/response> ; |
| 46 | + sld:type cwl:File . |
| 47 | +""" |
| 48 | + |
| 49 | + argsl = ['--print-rdf', 'https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl'] |
| 50 | + |
| 51 | + # capture stdout |
| 52 | + out = StringIO() |
| 53 | + main(argsl=argsl, stdout=out) |
| 54 | + # check substring in the actual print-rdf |
| 55 | + self.assertTrue(expected_output in out.getvalue(), True) |
0 commit comments