Commit 0974d609 authored by Fabien Amarger's avatar Fabien Amarger
Browse files

feat(test): Add multi class fragment test

parent 5333d19bc015
...@@ -67,6 +67,10 @@ ...@@ -67,6 +67,10 @@
if class_fragment is None: if class_fragment is None:
print(f"Warning: class {class_uri} could not be parsed") print(f"Warning: class {class_uri} could not be parsed")
continue continue
if class_fragment in ETYPE_URI:
raise ValueError(
f"Error: class {class_uri} and {ETYPE_URI[class_fragment]} use the same fragment"
)
schema.add_entity_type(EntityType(class_fragment)) schema.add_entity_type(EntityType(class_fragment))
entity_schema = schema._entities[class_fragment] entity_schema = schema._entities[class_fragment]
ETYPE_URI[class_fragment] = class_uri ETYPE_URI[class_fragment] = class_uri
......
@prefix loutre: <http://loutre.fr/>.
@prefix loutre2: <http://loutre2.fr/>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
loutre:Person a owl:Class.
loutre2:Person a owl:Class.
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
def test_transform_hierarchy(self): def test_transform_hierarchy(self):
self._load_owl_and_yams("test_hierarchy.owl", "test_hierarchy.yams") self._load_owl_and_yams("test_hierarchy.owl", "test_hierarchy.yams")
def test_raise_multi_class(self):
with self.assertRaises(ValueError):
self._load_owl_and_yams("test_multi_class.owl")
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment