control.assign_control - remove deprecated related_object argument support

This commit is contained in:
Andrej730
2026-03-18 10:27:07 +05:00
parent 05bf2b82d2
commit c03156b5cd
2 changed files with 1 additions and 41 deletions
@@ -15,38 +15,3 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
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)) == []