mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +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}")
|
||||
subject.add_brickifc_reference("http://example.org/digitaltwin#foo", element, project)
|
||||
brick = URIRef("http://example.org/digitaltwin#foo")
|
||||
bnode = list(BrickStore.graph.triples((brick, A, REF.IFCReference)))
|
||||
assert list(BrickStore.graph.triples((bnode, REF.hasIfcProjectReference, URIRef(project))))
|
||||
assert list(BrickStore.graph.triples((bnode, REF.ifcGlobalID, Literal(element.GlobalId))))
|
||||
assert list(BrickStore.graph.triples((bnode, REF.ifcName, Literal(element.Name))))
|
||||
bnode = next(BrickStore.graph.triples((brick, REF.hasExternalReference, None)))[2]
|
||||
assert len(list(BrickStore.graph.triples((bnode, REF.hasIfcProjectReference, URIRef(project))))) == 1
|
||||
assert len(list(BrickStore.graph.triples((bnode, REF.ifcGlobalID, Literal(element.GlobalId))))) == 1
|
||||
assert len(list(BrickStore.graph.triples((bnode, REF.ifcName, Literal(element.Name))))) == 1
|
||||
|
||||
|
||||
class TestAddRelation(NewFile):
|
||||
|
||||
Reference in New Issue
Block a user