From 0ce92587bf8d569ddb55b290004be1f35809b977 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 24 Sep 2024 15:17:12 +0500 Subject: [PATCH] ifc2sql - add test --- src/ifcpatch/test/test_Ifc2Sql.py | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/ifcpatch/test/test_Ifc2Sql.py diff --git a/src/ifcpatch/test/test_Ifc2Sql.py b/src/ifcpatch/test/test_Ifc2Sql.py new file mode 100644 index 0000000000..529cdb3214 --- /dev/null +++ b/src/ifcpatch/test/test_Ifc2Sql.py @@ -0,0 +1,46 @@ +# IfcOpenShell - IFC toolkit and geometry engine +# Copyright (C) 2022 Dion Moult +# +# This file is part of IfcOpenShell. +# +# IfcOpenShell is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# IfcOpenShell 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with IfcOpenShell. If not, see . + +import ifcpatch +import ifcopenshell +import ifcopenshell.api.context +import ifcopenshell.api.geometry +import ifcopenshell.api.georeference +import ifcopenshell.geom +import ifcopenshell.util.geolocation +import ifcopenshell.util.placement +import ifcopenshell.util.representation +import ifcopenshell.util.shape +import ifcopenshell.util.shape_builder +import test.bootstrap +from pathlib import Path + + +class TestIfc2Sql: + def test_run(self): + TEST_FILE = Path(__file__).parent / "files" / "basic.ifc" + sqlite_path = ifcpatch.execute( + {"file": ifcopenshell.open(TEST_FILE), "recipe": "Ifc2Sql", "arguments": ["sqlite"]} + ) + assert isinstance(sqlite_path, str) + assert sqlite_path.endswith(".ifcsqlite") + + # Ensure file is valid. + ifc_sqlite = ifcopenshell.open(sqlite_path) + assert isinstance(ifc_sqlite, ifcopenshell.sqlite) + assert ifc_sqlite.by_id(1)