Files
IfcOpenShell/src/bonsai/test/tool/test_sequence.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.9 KiB
Python
Raw Normal View History

# Bonsai - OpenBIM Blender Add-on
# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com>
#
# This file is part of Bonsai.
#
# Bonsai is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bonsai is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import os
import bpy
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.pset
import ifcopenshell.api.root
import bonsai.core.tool
import bonsai.tool as tool
from test.bim.bootstrap import NewFile
from bonsai.tool.sequence import Sequence as subject
class TestImplementsTool(NewFile):
def test_run(self):
assert isinstance(subject(), bonsai.core.tool.Sequence)
class TestGetElementStatus(NewFile):
def test_common_pset(self):
ifc = ifcopenshell.file()
element = ifcopenshell.api.root.create_entity(ifc, "IfcWall")
pset = ifcopenshell.api.pset.add_pset(ifc, element, "Pset_WallCommon")
ifcopenshell.api.pset.edit_pset(ifc, pset, properties={"Status": ["EXISTING", "TEMPORARY"]})
assert subject.get_element_status(element) == {"EXISTING", "TEMPORARY"}
def test_epset(self):
bpy.ops.bim.create_project()
ifc = tool.Ifc.get()
element = ifcopenshell.api.root.create_entity(ifc, "IfcWall")
pset = ifcopenshell.api.pset.add_pset(ifc, element, "EPset_Status")
ifcopenshell.api.pset.edit_pset(ifc, pset, properties={"Status": ["EXISTING", "TEMPORARY"]})
assert subject.get_element_status(element) == {"EXISTING", "TEMPORARY"}