about summary refs log tree commit diff
path: root/test/test_shex.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_shex.py')
-rw-r--r--test/test_shex.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test_shex.py b/test/test_shex.py
index 50ce723..e5d97cc 100644
--- a/test/test_shex.py
+++ b/test/test_shex.py
@@ -1,9 +1,9 @@
 import schema_salad.schema
 import schema_salad.ref_resolver
 import schema_salad.jsonld_context
-import pkg_resources
+# import pkg_resources
 import logging
-import traceback
+# import traceback
 # from rdflib import Graph, Namespace
 from pyshex.evaluate import evaluate
 import unittest
@@ -17,17 +17,19 @@ class TestStringMethods(unittest.TestCase):
              avsc_names,
              schema_metadata,
              metaschema_loader) = metadata_schema
-            print(metadata_schema)
-            assert(isinstance(avsc_names, schema_salad.avro.schema.Names))
+            # print(metadata_schema)
+            self.assertTrue(isinstance(avsc_names, schema_salad.avro.schema.Names))
             metadatafile = "test/data/input/TN_UT2.yaml"
             doc, metadata = schema_salad.schema.load_and_validate(document_loader, avsc_names, metadatafile, True)
             print(doc)
             g = schema_salad.jsonld_context.makerdf("workflow", doc, document_loader.ctx)
-            shex = pkg_resources.resource_stream(__name__, "../bh20sequploader/bh20seq-shex.rdf").read().decode("utf-8")
+            with open("bh20sequploader/bh20seq-shex.rdf") as f:
+                shex = f.read()
             # Note the https link simply acts as a URI descriptor (it does not fetch)
             rslt, reason = evaluate(g, shex, doc["id"], "https://raw.githubusercontent.com/arvados/bh20-seq-resource/master/bh20sequploader/bh20seq-shex.rdf#submissionShape")
 
-            g.serialize(format="ntriples")
+            with open("test/data/regression/TN_UT2.rdf","w") as f:
+                f.write(g.serialize(format="ntriples").decode("utf-8"))
 
             if not rslt:
                 raise Exception(reason)