diff options
Diffstat (limited to 'test/serd_test_util')
-rw-r--r-- | test/serd_test_util/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/serd_test_util/__init__.py b/test/serd_test_util/__init__.py index 844c454c..7482762d 100644 --- a/test/serd_test_util/__init__.py +++ b/test/serd_test_util/__init__.py @@ -71,6 +71,25 @@ def uri_path(uri): return path if not drive else path[1:] +def file_path(suite_dir, uri): + """Return a relative path to a file in a test suite.""" + + return os.path.relpath(os.path.join(suite_dir, os.path.basename(uri))) + + +def syntax_from_path(path): + """Return the serd syntax name corresponding to a file path.""" + + extensions = { + ".ttl": "turtle", + ".nt": "ntriples", + ".trig": "trig", + ".nq": "nquads", + } + + return extensions[os.path.splitext(path)[1]] + + def earl_assertion(test, passed, asserter): """Return a Turtle description of an assertion for the test report.""" |