From 3faf3b38001cf4ce67592b5a2e8364d802229b2d Mon Sep 17 00:00:00 2001 From: Harshad Date: Mon, 7 Aug 2023 11:35:48 -0500 Subject: [PATCH] Test prefix maps using bioregistry's epm as reference. (#406) Drafted with @matentzn over a call. --- tests/test_prefixes.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/test_prefixes.py diff --git a/tests/test_prefixes.py b/tests/test_prefixes.py new file mode 100644 index 00000000..b036cce0 --- /dev/null +++ b/tests/test_prefixes.py @@ -0,0 +1,18 @@ +"""Test for built-in prefixes.""" + +import unittest + +from sssom.context import get_extended_prefix_map, get_jsonld_context + + +class TestPrefix(unittest.TestCase): + """A test case for testing prefixes using EPM.""" + + def test_builtin_prefixes(self): + """This test ensures that the bioregistry managed EPM (extended prefix-map) does not deviate from the fixed SSSOM built-in prefixes.""" + prefix_map = get_extended_prefix_map() + sssom_schema_context = get_jsonld_context() + for k, v in prefix_map.items(): + if isinstance(v, str): + if k in sssom_schema_context["@context"]: + self.assertTrue(sssom_schema_context["@context"][k] == v)