diff planemo/lib/python3.7/site-packages/schema_salad/tests/test_fp.py @ 1:56ad4e20f292 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:32:28 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/planemo/lib/python3.7/site-packages/schema_salad/tests/test_fp.py	Fri Jul 31 00:32:28 2020 -0400
@@ -0,0 +1,52 @@
+from __future__ import absolute_import, print_function
+
+import pytest
+import six
+
+from schema_salad.schema import load_and_validate, load_schema
+from schema_salad.validate import ValidationException
+
+from .util import get_data
+
+
+def test_fp():
+    document_loader, avsc_names, schema_metadata, metaschema_loader = load_schema(
+        get_data(u"tests/test_schema/CommonWorkflowLanguage.yml")
+    )
+
+    for t in (
+        "foreign/foreign_prop1.cwl",
+        "foreign/foreign_prop2.cwl",
+        "foreign/foreign_prop3.cwl",
+        "foreign/foreign_prop4.cwl",
+        "foreign/foreign_prop5.cwl",
+        "foreign/foreign_prop6.cwl",
+        "foreign/foreign_prop7.cwl",
+    ):
+        load_and_validate(
+            document_loader,
+            avsc_names,
+            six.text_type(get_data("tests/" + t)),
+            True,
+            strict_foreign_properties=False,
+        )
+
+    for t in (
+        "foreign/foreign_prop1.cwl",
+        "foreign/foreign_prop2.cwl",
+        "foreign/foreign_prop4.cwl",
+        "foreign/foreign_prop5.cwl",
+    ):
+        with pytest.raises(ValidationException):
+            try:
+                print(t)
+                load_and_validate(
+                    document_loader,
+                    avsc_names,
+                    six.text_type(get_data("tests/" + t)),
+                    True,
+                    strict_foreign_properties=True,
+                )
+            except ValidationException as e:
+                print("\n", e)
+                raise