mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 01:10:03 +00:00
test_brick: fix warnings from sqlalchemy
When fixing warnings, noticed that was working a bit inproperly - `bnode` always end up being an empty list (because there's no `brick, A, REF.IFCReference` triple), so then passing empty list to `triples` resulted in selecting all nodes isntead of just the expected `bnode` (that's the behaviour `sqlachemy` was sending the warnings about - when empty lists unexpectedly selected everything).
This commit is contained in:
@@ -148,10 +148,10 @@ class TestAddBrickifcReference(NewFile):
|
|||||||
project = URIRef(f"http://example.org/digitaltwin#{tool.Ifc.get().by_type('IfcProject')[0].GlobalId}")
|
project = URIRef(f"http://example.org/digitaltwin#{tool.Ifc.get().by_type('IfcProject')[0].GlobalId}")
|
||||||
subject.add_brickifc_reference("http://example.org/digitaltwin#foo", element, project)
|
subject.add_brickifc_reference("http://example.org/digitaltwin#foo", element, project)
|
||||||
brick = URIRef("http://example.org/digitaltwin#foo")
|
brick = URIRef("http://example.org/digitaltwin#foo")
|
||||||
bnode = list(BrickStore.graph.triples((brick, A, REF.IFCReference)))
|
bnode = next(BrickStore.graph.triples((brick, REF.hasExternalReference, None)))[2]
|
||||||
assert list(BrickStore.graph.triples((bnode, REF.hasIfcProjectReference, URIRef(project))))
|
assert len(list(BrickStore.graph.triples((bnode, REF.hasIfcProjectReference, URIRef(project))))) == 1
|
||||||
assert list(BrickStore.graph.triples((bnode, REF.ifcGlobalID, Literal(element.GlobalId))))
|
assert len(list(BrickStore.graph.triples((bnode, REF.ifcGlobalID, Literal(element.GlobalId))))) == 1
|
||||||
assert list(BrickStore.graph.triples((bnode, REF.ifcName, Literal(element.Name))))
|
assert len(list(BrickStore.graph.triples((bnode, REF.ifcName, Literal(element.Name))))) == 1
|
||||||
|
|
||||||
|
|
||||||
class TestAddRelation(NewFile):
|
class TestAddRelation(NewFile):
|
||||||
|
|||||||
Reference in New Issue
Block a user