From d9d3f67b38871db579cc1b364409176a5491fbc1 Mon Sep 17 00:00:00 2001 From: spo Date: Thu, 10 Dec 2015 10:15:39 +0300 Subject: [PATCH] Add missing file --- src/PythonAPI/Test/TestFeatures.py | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/PythonAPI/Test/TestFeatures.py diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py new file mode 100644 index 000000000..e043fe9da --- /dev/null +++ b/src/PythonAPI/Test/TestFeatures.py @@ -0,0 +1,73 @@ +import unittest + +import ModelAPI + +import model + +#----------------------------------------------------------------------------- +# Fixtures + +class FeaturesFixture(unittest.TestCase): + + def setUp(self): + model.begin() + # Create part + partset = model.moduleDocument() + self.part = model.addPart(partset).document() + model.do() + + def tearDown(self): + model.end() + model.reset() + +#----------------------------------------------------------------------------- +# TestCases + +class FeaturesTestCase(FeaturesFixture): + + def test_assert_error_on_empty_args(self): + features = [ + "addPoint", "addAxis", "addPlane", + "addImport", "exportToFile", + "addAddition", "addSubtraction", "addIntersection", + "addExtrusion", "addExtrusionCut", "addExtrusionFuse", "addExtrusionSketch", + "addRevolution", "addRevolutionCut", "addRevolutionFuse", "addRevolutionSketch", + "addPlacement", "addRotation", "addTranslation", + "addGroup", + "addParameter", + ] + for name in features: + try: + with self.assertRaises(AssertionError): + feature = getattr(model, name)(self.part) + except AssertionError as e: + self.fail("%s does not check empty args" % name) + + def test_initialize_without_attributes(self): + model.construction.axis.Axis(self.part.addFeature("Axis")) + model.construction.plane.Plane(self.part.addFeature("Plane")) + model.construction.point.Point(self.part.addFeature("Point")) + + model.exchange.Import(self.part.addFeature("Import")) + model.exchange.Export(self.part.addFeature("Export")) + + model.features.boolean.Boolean(self.part.addFeature("Boolean")) + model.features.extrusion.Extrusion(self.part.addFeature("Extrusion")) + model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut")) + model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse")) + model.features.extrusion_sketch.ExtrusionSketch(self.part.addFeature("ExtrusionSketch")) + model.features.revolution.Revolution(self.part.addFeature("Revolution")) + model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionCut")) + model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionFuse")) + model.features.revolution_sketch.RevolutionSketch(self.part.addFeature("RevolutionSketch")) + model.features.placement.Placement(self.part.addFeature("Placement")) + model.features.rotation.Rotation(self.part.addFeature("Rotation")) + model.features.translation.Translation(self.part.addFeature("Translation")) + model.features.group.Group(self.part.addFeature("Group")) + + model.parameter.Parameter(self.part.addFeature("Parameter")) + +#----------------------------------------------------------------------------- + +if __name__ == "__main__": + unittest.main() -- 2.39.2