Work a bit on failing tests

This commit is contained in:
Thomas Krijnen
2026-05-06 11:41:43 +02:00
parent ea4747ccb1
commit 4670715ef3
35 changed files with 270 additions and 70 deletions
@@ -103,7 +103,7 @@ class entity_instance_mixin:
idx = self.get_argument_index(name)
return self.get_argument(idx)
elif attr_cat == INVERSE:
vs = self.get_inverse(name)
vs = self._get_inverse(name)
if settings.unpack_non_aggregate_inverses:
schema_name = self.is_a(True).split(".")[0]
ent: ifcopenshell_wrapper.entity
@@ -17,12 +17,22 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
from ifcopenshell.api.alignment._add_segment_to_layout import _add_segment_to_layout
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_add_segment_to_layout():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -71,6 +81,3 @@ def test_add_segment_to_layout():
assert len(segment_nest.RelatedObjects) == 2
referent_nest = ifcopenshell.api.alignment.get_referent_nest(file, alignment)
assert len(referent_nest.RelatedObjects) == 3
test_add_segment_to_layout()
@@ -17,12 +17,22 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
import ifcopenshell.util.element
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_add_stationing_to_alignment():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -47,6 +57,3 @@ def test_add_stationing_to_alignment():
assert ifcopenshell.util.element.get_pset(element=referent, name="Pset_Stationing")
assert ifcopenshell.util.element.get_pset(element=referent, name="Pset_Stationing", prop="Station") == 2000.0
assert referent.ObjectPlacement != None
test_add_stationing_to_alignment()
@@ -17,11 +17,21 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_add_vertical_alignment():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -70,6 +80,3 @@ def test_add_vertical_alignment():
assert len(alignment.IsNestedBy) == 2
assert len(layout_nest.RelatedObjects) == 1
assert layout_nest.RelatedObjects[0].is_a("IfcAlignmentHorizontal")
test_add_vertical_alignment()
@@ -17,11 +17,21 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_create():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -81,6 +91,3 @@ def test_create():
curves = file.by_type("IfcSegmentedReferenceCurve")
for curve in curves:
assert ifcopenshell.api.alignment.has_zero_length_segment(curve)
test_create()
@@ -18,12 +18,22 @@
import math
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.unit
import ifcopenshell.util
import ifcopenshell.util.unit
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_create_as_offset_curve():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="OCBD Test Alignment")
@@ -135,6 +145,3 @@ def test_create_as_offset_curve():
curve = ifcopenshell.api.alignment.get_curve(offset_alignment)
assert curve.is_a("IfcOffsetCurveByDistances")
assert curve.BasisCurve == basis_curve
test_create_as_offset_curve()
@@ -17,10 +17,20 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_create_as_polyline():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -44,6 +54,3 @@ def test_create_as_polyline():
curve = ifcopenshell.api.alignment.get_curve(alignment)
assert curve.is_a("IfcPolyline")
assert len(curve.Points) == 10
test_create_as_polyline()
@@ -17,11 +17,21 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_create_by_pi_method():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -61,6 +71,3 @@ def test_create_by_pi_method():
vertical_layout = ifcopenshell.api.alignment.get_vertical_layout(alignment)
vertical_segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(vertical_layout)
assert len(vertical_segment_nest.RelatedObjects) == 10
test_create_by_pi_method()
@@ -18,11 +18,20 @@
import math
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _test_horizontal() -> ifcopenshell.file:
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -268,10 +277,8 @@ def _test_horizontal_vertical2(file: ifcopenshell.file):
assert len(curve.Segments) == 3
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_append_segment():
file = _test_horizontal()
_test_horizontal_vertical()
_test_horizontal_vertical2(file)
test_append_segment()
@@ -17,10 +17,20 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_create_no_geometry():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -62,6 +72,3 @@ def test_create_no_geometry():
)
end = ifcopenshell.api.alignment.create_layout_segment(file, vertical_alignment, design_parameters)
assert end == None
test_create_no_geometry()
@@ -23,6 +23,14 @@ import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_distance_along_from_station():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -51,6 +59,3 @@ def test_distance_along_from_station():
# Station 175+25.36
assert ifcopenshell.api.alignment.distance_along_from_station(file, alignment, 17525.36) == pytest.approx(7525.36)
test_distance_along_from_station()
@@ -17,11 +17,21 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_get_alignment():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -17,11 +17,20 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _test_horizontal():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -79,6 +88,7 @@ def _test_horizontal_and_vertical_and_cant():
assert basis_curve.is_a("IfcCompositeCurve")
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_get_basis_curve():
_test_horizontal()
_test_horizontal_and_vertical()
@@ -16,11 +16,21 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_get_curve():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -16,11 +16,21 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_get_layout_curve():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -16,11 +16,20 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _test_horizontal():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -84,10 +93,8 @@ def _test_horizontal_vertical_cant():
assert True == ifcopenshell.api.alignment.has_zero_length_segment(cant)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_has_zero_length_segment():
_test_horizontal()
_test_horizontal_vertical()
_test_horizontal_vertical_cant()
test_has_zero_length_segment()
@@ -17,14 +17,24 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
# other test cases cover the typical vertical by PI method (test_create_alignment_by_pi_method)
# this test will focus on the edge cases of no initial tangent run, no final tangent run, and
# compound curve (no tangent between curves)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_horizontal_layout_by_pi_method():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -52,6 +62,3 @@ def test_horizontal_layout_by_pi_method():
assert layout_nest.RelatedObjects[0].is_a("IfcAlignmentHorizontal")
segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(layout_nest.RelatedObjects[0])
assert len(segment_nest.RelatedObjects) == 3 # segments in horizontal layout
test_horizontal_layout_by_pi_method()
@@ -23,6 +23,11 @@ from ifcopenshell.api.alignment._map_alignment_cant_segment import (
_map_alignment_cant_segment,
)
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _BlossCurve_100_0_300_1000_1_Meter(file):
design_parameters = file.createIfcAlignmentCantSegment(
@@ -1896,6 +1901,7 @@ def _VienneseBend_100_0__inf__300_1_Meter(file):
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_map_alignment_cant_segment():
file = ifcopenshell.file(schema="IFC4X3")
_BlossCurve_100_0_300_1000_1_Meter(file)
@@ -1954,6 +1960,3 @@ def test_map_alignment_cant_segment():
_VienneseBend_100_0__1000__300_1_Meter(file)
_VienneseBend_100_0_inf_300_1_Meter(file)
_VienneseBend_100_0__inf__300_1_Meter(file)
test_map_alignment_cant_segment()
@@ -27,6 +27,11 @@ from ifcopenshell.api.alignment._map_alignment_horizontal_segment import (
_map_alignment_horizontal_segment,
)
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _BlossCurve_100_0_300_1000_1_Meter(file):
design_parameters = file.createIfcAlignmentHorizontalSegment(
@@ -2558,6 +2563,7 @@ def _VienneseBend_100_0__inf__300_1_Meter(file):
assert mapped_segment.ParentCurve.ConstantTerm == pytest.approx(None)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_map_alignment_horizontal_segment():
file = ifcopenshell.file(schema="IFC4X3")
_BlossCurve_100_0_300_1000_1_Meter(file)
@@ -2632,6 +2638,3 @@ def test_map_alignment_horizontal_segment():
_VienneseBend_100_0__1000__300_1_Meter(file)
_VienneseBend_100_0_inf_300_1_Meter(file)
_VienneseBend_100_0__inf__300_1_Meter(file)
test_map_alignment_horizontal_segment()
@@ -26,6 +26,11 @@ from ifcopenshell.api.alignment._map_alignment_vertical_segment import (
_map_alignment_vertical_segment,
)
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _CircularArc_100_0_10_0_0_0_0_5_1_Meter(file):
design_parameters = file.createIfcAlignmentVerticalSegment(
@@ -769,6 +774,7 @@ def _ParabolicArc_100_0_10_0__1_0__0_5_1_Meter(file):
assert mapped_segment.ParentCurve.CoefficientsY == pytest.approx((10.0, -1.0, 0.0025))
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_map_alignment_vertical_segment():
file = ifcopenshell.file(schema="IFC4X3")
_CircularArc_100_0_10_0_0_0_0_5_1_Meter(file)
@@ -797,6 +803,3 @@ def test_map_alignment_vertical_segment():
_ParabolicArc_100_0_10_0__1_0__0_5_1_Meter(file)
# VERTICAL CLOTHOID NOT IMPLEMENTED
test_map_alignment_vertical_segment()
@@ -17,11 +17,21 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_name_segments():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -54,6 +64,3 @@ def test_name_segments():
for segment in segment_nest.RelatedObjects:
assert f"Q{i}" == segment.Name
i += 1
test_name_segments()
@@ -23,6 +23,13 @@ import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.fixture(scope="module")
def default_names_alignment():
file = ifcopenshell.file(schema="IFC4X3")
@@ -96,6 +103,7 @@ def callback_alignment():
yield alignment
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_with_default_names(default_names_alignment):
referent_nest = ifcopenshell.api.alignment.get_referent_nest(None, default_names_alignment)
@@ -104,6 +112,7 @@ def test_with_default_names(default_names_alignment):
assert [x in r.Name for x in expected]
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_with_callbacks(callback_alignment):
referent_nest = ifcopenshell.api.alignment.get_referent_nest(None, callback_alignment)
@@ -17,12 +17,19 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.context
import ifcopenshell.api.unit
from ifcopenshell.api.alignment._update_curve_segment_transition_code import (
_update_curve_segment_transition_code,
)
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _test1():
file = ifcopenshell.file(schema="IFC4X3")
@@ -243,9 +250,7 @@ def _test2():
assert clothoid2.Transition == "CONTSAMEGRADIENTSAMECURVATURE"
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_update_curve_segment_transition_code():
_test1()
_test2()
test_update_curve_segment_transition_code()
@@ -23,6 +23,14 @@ import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_update_fallback_position():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -67,6 +75,3 @@ def test_update_fallback_position():
(0.22453152656315067, 0.9744668252840736, 0.0)
)
assert lp.CartesianPosition.Axis.DirectionRatios == pytest.approx((0.0, 0.0, 1.0))
test_update_fallback_position()
@@ -17,14 +17,24 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell.api.alignment
import ifcopenshell.api.context
import ifcopenshell.api.unit
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
# other test cases cover the typical vertical by PI method (test_create_alignment_by_pi_method)
# this test will focus on the edge cases of no initial gradient, no final gradient, and
# compound vertical curve (no gradient between curves)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_vertical_layout_by_pi_method():
file = ifcopenshell.file(schema="IFC4X3")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -69,6 +79,3 @@ def test_vertical_layout_by_pi_method():
segment_nest = ifcopenshell.api.alignment.get_alignment_segment_nest(vlayout)
assert len(segment_nest.RelatedObjects) == 3
test_vertical_layout_by_pi_method()
@@ -23,6 +23,14 @@ import ifcopenshell.api.cogo
import ifcopenshell.api.context
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_add_survey_point():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(Name="Test")
@@ -23,6 +23,14 @@ import ifcopenshell.api.cogo
import ifcopenshell.api.context
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_assign_survey_point():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(Name="Test")
@@ -69,6 +69,3 @@ def test_bearing2dd():
with pytest.raises(ValueError, match="Invalid bearing string"):
ifcopenshell.api.cogo.bearing2dd("N 45 15 99.5 E")
test_bearing2dd()
@@ -23,6 +23,14 @@ import ifcopenshell.api.cogo
import ifcopenshell.api.context
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_edit_survey_point():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(Name="Test")
@@ -22,6 +22,12 @@ import ifcopenshell
import test.bootstrap
try:
ifcopenshell.file(schema="IFC4X3")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
class TestTransaction(test.bootstrap.IFC4):
def test_that_nothing_happens_without_a_transaction(self):
wall = self.file.createIfcWall()
@@ -158,12 +164,14 @@ class TestFile(test.bootstrap.IFC4):
assert f.schema_identifier == "IFC4"
assert f.schema_version == (4, 0, 0, 0)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_creating_an_ifc4x3_file(self):
f = ifcopenshell.file(schema="IFC4X3")
assert f.schema == "IFC4X3"
assert f.schema_identifier == "IFC4X3_ADD2"
assert f.schema_version == (4, 3, 2, 0)
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_creating_a_specific_version(self):
f = ifcopenshell.file(schema_version=(4, 3, 2, 0))
assert f.schema == "IFC4X3"
@@ -288,6 +296,7 @@ class TestFile(test.bootstrap.IFC4):
g.assign_header_from(f)
assert g.header.file_name.name == "test"
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_schema_identifier():
f = ifcopenshell.file(schema='IFC4X3')
assert f.schema_identifier == 'IFC4X3_ADD2'
@@ -16,11 +16,20 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import pytest
import ifcopenshell
import ifcopenshell.api.unit
import ifcopenshell.util.alignment as sta
try:
ifcopenshell.file(schema="IFC4X3_ADD2")
IFC4X3_AVAILABLE = True
except RuntimeError:
IFC4X3_AVAILABLE = False
def _test_si_stations():
file = ifcopenshell.file(schema="IFC4X3_ADD2")
project = file.createIfcProject(GlobalId=ifcopenshell.guid.new(), Name="Test")
@@ -77,10 +86,8 @@ def _test_us_stations():
assert s == "-1234+56.79"
@pytest.mark.skipif(not IFC4X3_AVAILABLE, reason="IFC4X3 not available")
def test_station_as_string():
_test_si_stations()
_test_si_stations_millimeter()
_test_us_stations()
test_station_as_string()