mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
removed get_property in attributes_psets step file (not implemented yet) (#1596)
* removed get_property in attributes_psets step file (not implemented yet) problem with stepmatcher remains * Fix pattern search for properties
This commit is contained in:
@@ -5,7 +5,7 @@ from bimtester.util import assert_elements
|
||||
from bimtester.lang import _
|
||||
|
||||
|
||||
@step("all {ifc_class} elements have an {aproperty} property in the {pset} pset")
|
||||
@step("All {ifc_class} elements have an {aproperty} property in the {pset} pset")
|
||||
def step_impl(context, ifc_class, aproperty, pset):
|
||||
eleclass_has_property_in_pset(
|
||||
context,
|
||||
@@ -21,31 +21,42 @@ def step_impl(context, ifc_class, aproperty, pset):
|
||||
use_step_matcher("re")
|
||||
|
||||
|
||||
@step(r"all (?P<ifc_class>.*) elements have an? (?P<property_path>.*\..*) property")
|
||||
@step(r"All (?P<ifc_class>.*) elements have an? (?P<property_path>.*\..*) property")
|
||||
def step_impl(context, ifc_class, property_path):
|
||||
pset_name, property_name = property_path.split(".")
|
||||
elements = IfcStore.file.by_type(ifc_class)
|
||||
for element in elements:
|
||||
if not IfcStore.file.get_property(element, pset_name, property_name):
|
||||
assert False
|
||||
import re
|
||||
pset, aproperty = property_path.split(".")
|
||||
eleclass_has_property_in_pset(
|
||||
context,
|
||||
ifc_class,
|
||||
aproperty,
|
||||
pset
|
||||
)
|
||||
|
||||
|
||||
@step(
|
||||
r'all (?P<ifc_class>.*) elements have an? (?P<property_path>.*\..*) property value matching the pattern "(?P<pattern>.*)"'
|
||||
@step(r'All (?P<ifc_class>.*) elements have an? (?P<property_path>.*\..*) property value matching the pattern "(?P<pattern>.*)"'
|
||||
)
|
||||
def step_impl(context, ifc_class, property_path, pattern):
|
||||
import re
|
||||
from ifcopenshell.util.element import get_psets
|
||||
|
||||
pset_name, property_name = property_path.split(".")
|
||||
elements = IfcStore.file.by_type(ifc_class)
|
||||
for element in elements:
|
||||
prop = IfcStore.file.get_property(element, pset_name, property_name)
|
||||
if not prop:
|
||||
|
||||
psets = get_psets(element)
|
||||
|
||||
if not pset_name in psets:
|
||||
assert False
|
||||
|
||||
pset = psets[pset_name]
|
||||
if not property_name in pset:
|
||||
assert False
|
||||
|
||||
prop = pset[property_name]
|
||||
# get_psets returns just strings
|
||||
|
||||
if not re.search(pattern, prop):
|
||||
assert False
|
||||
# For now, we only check single values
|
||||
if prop.is_a("IfcPropertySingleValue"):
|
||||
if not (prop.NominalValue and re.search(pattern, prop.NominalValue.wrappedValue)):
|
||||
assert False
|
||||
|
||||
|
||||
def eleclass_has_property_in_pset(
|
||||
|
||||
@@ -2,6 +2,7 @@ import datetime
|
||||
import json
|
||||
import os
|
||||
import pystache
|
||||
import sys
|
||||
from bimtester.lang import _
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user