Files
IfcOpenShell/src/ifcquery/tests/test_schema.py
T
Bruno Postle 7cd40bf8cb Add ifcquery CLI tool for IFC model interrogation (#7845)
ifcquery is a new command-line tool for querying and inspecting IFC models. All output is JSON.

Subcommands:

    summary — schema version, entity counts, project metadata
    tree — full spatial hierarchy (Project → Site → Building → Storeys → Spaces → Elements)
    info <id> — deep inspection of any entity by step ID (attributes, psets, placement matrix, type, material)
    select <query> — filter elements using ifcopenshell selector syntax
    relations <id> — relationships for an element; --traverse up walks to IfcProject
    clash <id> — geometric intersection and clearance detection
    validate — schema/constraint validation; --rules adds EXPRESS checks
    schedule — work schedules with nested task trees
    cost — cost schedules with nested cost item trees
    schema <class> — IFC class documentation from the model's schema version
    plot — SVG plan drawing
    render — 3D geometry rendering
    contexts — geometric representation contexts
    materials — material assignments

Usage:

python3 -m ifcquery <file.ifc> <subcommand> [args]

Generated with the assistance of an AI coding tool.
2026-03-23 23:29:32 +00:00

33 lines
1.0 KiB
Python

# This file was generated with the assistance of an AI coding tool.
from __future__ import annotations
import pytest
from ifcquery.schema import schema
class TestSchema:
def test_ifc_wall_has_description(self, model):
result = schema(model, "IfcWall")
assert "description" in result
assert isinstance(result["description"], str)
assert len(result["description"]) > 0
def test_ifc_wall_has_attributes(self, model):
result = schema(model, "IfcWall")
assert "attributes" in result
def test_ifc_wall_has_spec_url(self, model):
result = schema(model, "IfcWall")
assert "spec_url" in result
def test_unknown_entity_returns_error(self, model):
result = schema(model, "IfcNonExistentFooBar")
assert "error" in result
assert "IfcNonExistentFooBar" in result["error"]
def test_ifc_window_has_description(self, model):
result = schema(model, "IfcWindow")
assert "description" in result
assert len(result["description"]) > 0