1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## Lesser General Public License for more details.
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
25 from salome.shaper import model
27 #-----------------------------------------------------------------------------
30 class FeaturesFixture(unittest.TestCase):
35 partset = model.moduleDocument()
36 self.part = model.addPart(partset).document()
41 # assert(model.checkPythonDump())
42 # This test checks creation of High API classes from low-level.
43 # It does not set any attributes, so features invalid, and dump also invalid.
46 #-----------------------------------------------------------------------------
49 class FeaturesTestCase(FeaturesFixture):
51 # def test_assert_error_on_empty_args(self):
53 # # Implemented in C++, add* without arguments doesn't exist
54 # # "addPoint", "addPlane",
55 # # "addImport", "exportToFile",
58 # "addCut", "addFuse", "addCommon",
60 # # "addExtrusionCut", "addExtrusionFuse",
62 # # "addRevolutionCut", "addRevolutionFuse",
63 # "addPlacement", "addRotation", "addTranslation",
67 # for name in features:
69 # with self.assertRaises(AssertionError):
70 # feature = getattr(model, name)(self.part)
71 # except AssertionError as e:
72 # self.fail("%s does not check empty args" % name)
74 def test_addPoint(self):
75 model.addPoint(self.part, 10, "20", "x + 30")
77 def test_initialize_without_attributes(self):
78 import ConstructionAPI
79 ConstructionAPI.ConstructionAPI_Axis(self.part.addFeature("Axis"))
80 ConstructionAPI.ConstructionAPI_Plane(self.part.addFeature("Plane"))
81 ConstructionAPI.ConstructionAPI_Point(self.part.addFeature("Point"))
84 ExchangeAPI.ExchangeAPI_Import(self.part.addFeature("Import"))
87 FeaturesAPI.FeaturesAPI_Boolean(self.part.addFeature("Boolean"))
88 FeaturesAPI.FeaturesAPI_Extrusion(self.part.addFeature("Extrusion"))
89 FeaturesAPI.FeaturesAPI_ExtrusionCut(self.part.addFeature("ExtrusionCut"))
90 FeaturesAPI.FeaturesAPI_ExtrusionFuse(self.part.addFeature("ExtrusionFuse"))
91 FeaturesAPI.FeaturesAPI_Revolution(self.part.addFeature("Revolution"))
92 FeaturesAPI.FeaturesAPI_RevolutionCut(self.part.addFeature("RevolutionCut"))
93 FeaturesAPI.FeaturesAPI_RevolutionFuse(self.part.addFeature("RevolutionFuse"))
94 FeaturesAPI.FeaturesAPI_Placement(self.part.addFeature("Placement"))
95 FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation"))
96 FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation"))
99 CollectionAPI.CollectionAPI_Group(self.part.addFeature("Group"))
102 PrimitivesAPI.PrimitivesAPI_Box(self.part.addFeature("Box"))
105 ParametersAPI.ParametersAPI_Parameter(self.part.addFeature("Parameter"))
107 #-----------------------------------------------------------------------------
109 if __name__ == "__main__":
110 unittest.main(exit=False)