mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
test_sql - use Ifc2Sql patcher for readability
This commit is contained in:
@@ -20,6 +20,7 @@ import tempfile
|
|||||||
import ifcpatch
|
import ifcpatch
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from ifcpatch.recipes import Ifc2Sql
|
||||||
|
|
||||||
TEST_FILE = Path(__file__).parent / "files" / "basic.ifc"
|
TEST_FILE = Path(__file__).parent / "files" / "basic.ifc"
|
||||||
SQLITE_PATH = None
|
SQLITE_PATH = None
|
||||||
@@ -29,13 +30,10 @@ def get_ifc_sqlite() -> ifcopenshell.sqlite:
|
|||||||
global SQLITE_PATH
|
global SQLITE_PATH
|
||||||
if SQLITE_PATH is None:
|
if SQLITE_PATH is None:
|
||||||
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".ifcsqlite")
|
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".ifcsqlite")
|
||||||
ifcpatch.execute(
|
ifc_file = ifcopenshell.open(TEST_FILE)
|
||||||
{
|
assert isinstance(ifc_file, ifcopenshell.file)
|
||||||
"file": ifcopenshell.open(TEST_FILE),
|
patcher = Ifc2Sql.Patcher(ifc_file, database=tmp.name)
|
||||||
"recipe": "Ifc2Sql",
|
patcher.patch()
|
||||||
"arguments": ["sqlite", None, None, None, tmp.name],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
SQLITE_PATH = tmp.name
|
SQLITE_PATH = tmp.name
|
||||||
ifc_sqlite = ifcopenshell.open(SQLITE_PATH)
|
ifc_sqlite = ifcopenshell.open(SQLITE_PATH)
|
||||||
assert isinstance(ifc_sqlite, ifcopenshell.sqlite)
|
assert isinstance(ifc_sqlite, ifcopenshell.sqlite)
|
||||||
|
|||||||
Reference in New Issue
Block a user