Skip to content

Commit

Permalink
add test cases for recent code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gtfierro committed Oct 25, 2023
1 parent ca889f4 commit a06faa4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/unit/dataclasses/test_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ def test_load_library_from_ontology(bm: BuildingMOTIF):
assert len(shapeg.graph) > 1


def test_load_library_from_ontology_with_error(bm: BuildingMOTIF):
with pytest.raises(Exception):
Library.load(ontology_graph="tests/unit/fixtures/bad_shape_template.ttl")


def test_load_shapes_with_directory_library(bm: BuildingMOTIF):
lib = Library.load(directory="tests/unit/fixtures/shapes")
assert lib is not None
assert len(lib.get_templates()) == 1


def test_load_library_from_directory(bm: BuildingMOTIF):
lib = Library.load(directory="tests/unit/fixtures/templates")
assert lib is not None
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/fixtures/bad_shape_template.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix : <urn:shape1/> .

: a owl:Ontology .

:vav_shape a sh:NodeShape ;
sh:targetClass brick:VAV ;
sh:property [
sh:qualifiedValueShape [ sh:class brick:Air_Flow_Sensor ] ;
sh:qualifiedMinCount 1 ;
sh:minCount 1;
] ;
.
2 changes: 1 addition & 1 deletion tests/unit/fixtures/shapes/shape1.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

: a owl:Ontology .

:vav_shape a sh:NodeShape ;
:vav_shape a owl:Class, sh:NodeShape ;
sh:targetClass brick:VAV ;
sh:property [
sh:path brick:hasPoint ;
Expand Down

0 comments on commit a06faa4

Please sign in to comment.