mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
control.assign_control - remove deprecated related_object argument support
This commit is contained in:
@@ -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)) == []
|
||||
|
||||
Reference in New Issue
Block a user