From c03156b5cdfb8f3eb1d2be35ca4b61fdaeb21be7 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 18 Mar 2026 10:27:07 +0500 Subject: [PATCH] control.assign_control - remove deprecated related_object argument support --- .../ifcopenshell/api/__init__.py | 7 +--- src/ifcopenshell-python/test/api/test_api.py | 35 ------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/__init__.py b/src/ifcopenshell-python/ifcopenshell/api/__init__.py index 49c3b471dd..f485e865fb 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/api/__init__.py @@ -42,7 +42,6 @@ import importlib import inspect import json from collections.abc import Callable -from functools import partial from typing import TYPE_CHECKING, Any, Optional import numpy @@ -90,11 +89,7 @@ def renamed_arguments_deprecation( # "group.add_group": partial( # renamed_arguments_deprecation, arguments_remapped={"Name": "name", "Description": "description"} # ), -ARGUMENTS_DEPRECATION: dict[str, Callable[[str, dict[str, Any]], tuple[str, dict[str, Any]]]] = { - "control.assign_control": partial( - batching_argument_deprecation, prev_argument="related_object", new_argument="related_objects" - ), -} +ARGUMENTS_DEPRECATION: dict[str, Callable[[str, dict[str, Any]], tuple[str, dict[str, Any]]]] = {} CACHED_USECASE_CLASSES: dict[str, Callable] = {} diff --git a/src/ifcopenshell-python/test/api/test_api.py b/src/ifcopenshell-python/test/api/test_api.py index 7036f93528..8bed51a56f 100644 --- a/src/ifcopenshell-python/test/api/test_api.py +++ b/src/ifcopenshell-python/test/api/test_api.py @@ -15,38 +15,3 @@ # # You should have received a copy of the GNU Lesser General Public License # along with IfcOpenShell. If not, see . - -from datetime import datetime - -import ifcopenshell.api.control -import ifcopenshell.api.cost -import ifcopenshell.api.root -import ifcopenshell.util.element -import test.bootstrap - - -def deprecation_check(test): - def new_test(self): - assert datetime.now().date() < datetime(2026, 1, 9).date(), "API arguments are completely deprecated" - test(self) - - return new_test - - -class TestTemporarySupportForDeprecatedAPIArguments(test.bootstrap.IFC4): - @deprecation_check - def test_assigning_control(self): - model = self.file - element = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall") - control = ifcopenshell.api.cost.add_cost_schedule(model) - ifcopenshell.api.control.assign_control(model, relating_control=control, related_objects=[element]) - assert list(ifcopenshell.util.element.get_controls(element)) == [control] - - @deprecation_check - def test_unassigning_control(self): - TestTemporarySupportForDeprecatedAPIArguments.test_assigning_control(self) - model = self.file - element = model.by_type("IfcWall")[0] - control = model.by_type("IfcCostSchedule")[0] - ifcopenshell.api.control.unassign_control(model, relating_control=control, related_objects=[element]) - assert list(ifcopenshell.util.element.get_controls(element)) == []