maintain snake in api calls

there were only two methods using camel case for arguments
This commit is contained in:
Andrej730
2024-05-13 17:51:19 +05:00
parent 4e39fb3edd
commit fdbe74a432
19 changed files with 127 additions and 27 deletions
@@ -0,0 +1,37 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# 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 test.bootstrap
import ifcopenshell.api
import ifcopenshell.util.element
class TestAddGroup(test.bootstrap.IFC4):
def test_add_group_no_arguments(self):
group = ifcopenshell.api.run("group.add_group", self.file)
assert group.Name == "Unnamed"
assert group.Description == None
def test_add_group(self):
group = ifcopenshell.api.run("group.add_group", self.file, name="Name", description="Description")
assert group.Name == "Name"
assert group.Description == "Description"
class TestAddGroupIFC2X3(test.bootstrap.IFC2X3, TestAddGroup):
pass
@@ -0,0 +1,34 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2022 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# 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 test.bootstrap
import ifcopenshell.api
class TestAddLayer(test.bootstrap.IFC4):
def test_add_layer_no_arguments(self):
layer = ifcopenshell.api.run("layer.add_layer", self.file)
assert layer.Name == "Unnamed"
def test_assign_additional_items(self):
layer = ifcopenshell.api.run("layer.add_layer", self.file, name="Name")
assert layer.Name == "Name"
class TestAddLayerIFC2X3(test.bootstrap.IFC2X3, TestAddLayer):
pass
@@ -409,7 +409,7 @@ class TestRemoveProduct(test.bootstrap.IFC4):
def test_removing_orphaned_group_relationships(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
group = ifcopenshell.api.run("group.add_group", self.file, Name="Unit 1A")
group = ifcopenshell.api.run("group.add_group", self.file, name="Unit 1A")
ifcopenshell.api.run("group.assign_group", self.file, products=[element], group=group)
ifcopenshell.api.run("root.remove_product", self.file, product=element)
assert not self.file.by_type("IfcRelAssignsToGroup")
@@ -348,3 +348,14 @@ class TestTemporarySupportForDeprecatedAPIArguments(test.bootstrap.IFC4):
)
assert get_context(element_type) == None
assert len(self.file.by_type("IfcRelDeclares")) == 0
@deprecation_check
def test_add_group(self):
group = ifcopenshell.api.run("group.add_group", self.file, Name="Name", Description="Description")
assert group.Name == "Name"
assert group.Description == "Description"
@deprecation_check
def test_add_layer(self):
layer = ifcopenshell.api.run("layer.add_layer", self.file, Name="Name")
assert layer.Name == "Name"