Salome HOME
Bring batch tests to valid state
authorsbh <sergey.belash@opencascade.com>
Tue, 28 Oct 2014 12:45:56 +0000 (15:45 +0300)
committersbh <sergey.belash@opencascade.com>
Tue, 28 Oct 2014 12:45:56 +0000 (15:45 +0300)
src/ModelAPI/ModelAPI.i
src/SketchPlugin/Test/TestConstraintDistance.py
src/SketchPlugin/Test/TestConstraintLength.py
src/SketchPlugin/Test/TestConstraintParallel.py
src/SketchPlugin/Test/TestConstraintPerpendicular.py
src/SketchPlugin/Test/TestConstraintRadius.py
src/SketchPlugin/Test/TestSketchArcCircle.py
src/SketchPlugin/Test/TestSketchPointLine.py

index 7ff2bfc8e52974b6b3030849510dac2f7d67c6e1..ba16e8f1c1a2ffbe453e7956f5d3b59105f8092a 100644 (file)
@@ -8,6 +8,7 @@
   #include "ModelAPI_Session.h"
   #include "ModelAPI_Object.h"
   #include "ModelAPI_Feature.h"
+  #include "ModelAPI_CompositeFeature.h"
   #include "ModelAPI_Data.h"
   #include "ModelAPI_Attribute.h"
   #include "ModelAPI_AttributeDocRef.h"
   #include "ModelAPI_ResultBody.h"
   #include "ModelAPI_ResultPart.h"
   
-  template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Result> theObject) 
+  template<class T1, class T2> 
+  boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject)
   { 
-    return boost::dynamic_pointer_cast<T>(theObject); 
+    return boost::dynamic_pointer_cast<T1>(theObject); 
   }
   
-   
 %}
 
 // to avoid error on this
@@ -52,6 +53,7 @@
 %shared_ptr(ModelAPI_Session)
 %shared_ptr(ModelAPI_Object)
 %shared_ptr(ModelAPI_Feature)
+%shared_ptr(ModelAPI_CompositeFeature)
 %shared_ptr(ModelAPI_Data)
 %shared_ptr(ModelAPI_Attribute)
 %shared_ptr(ModelAPI_AttributeDocRef)
@@ -76,6 +78,7 @@
 %include "ModelAPI_Session.h"
 %include "ModelAPI_Object.h"
 %include "ModelAPI_Feature.h"
+%include "ModelAPI_CompositeFeature.h"
 %include "ModelAPI_Data.h"
 %include "ModelAPI_Attribute.h"
 %include "ModelAPI_AttributeDocRef.h"
 %template(ObjectList) std::list<boost::shared_ptr<ModelAPI_Object> >;
 %template(ResultList) std::list<boost::shared_ptr<ModelAPI_Result> >;
 
-template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Result> theObject);
-%template(modelAPI_ResultConstruction) castTo<ModelAPI_ResultConstruction>;
-%template(modelAPI_ResultBody) castTo<ModelAPI_ResultBody>;
-%template(modelAPI_ResultPart) castTo<ModelAPI_ResultPart>;
+template<class T1, class T2> boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject);
+%template(modelAPI_CompositeFeature) boost_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
+%template(modelAPI_ResultConstruction) boost_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
+%template(modelAPI_ResultBody) boost_cast<ModelAPI_ResultBody, ModelAPI_Result>;
+%template(modelAPI_ResultPart) boost_cast<ModelAPI_ResultPart, ModelAPI_Result>;
+
+
index 2d84321be0cf622a7f9d2b150233ed27e99138de..987851972f20ce5c7cab18dc5d7a10b5c91cfc19 100644 (file)
@@ -26,7 +26,7 @@ import math
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-07-29"
+__updated__ = "2014-10-28"
 
 
 def distance(pointA, pointB):
@@ -44,7 +44,8 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
 origin.setValue(0, 0, 0)
@@ -59,15 +60,12 @@ aSession.finishOperation()
 # Create a point and a line
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
-aSketchPoint = aDocument.addFeature("SketchPoint")
-aSketchReflist.append(aSketchPoint)
+aSketchPoint = aSketchFeature.addFeature("SketchPoint")
 aSketchPointData = aSketchPoint.data()
 aSketchPointCoords = geomDataAPI_Point2D(
     aSketchPointData.attribute("PointCoordindates"))
 aSketchPointCoords.setValue(50., 50.)
-aSketchLine = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLine)
+aSketchLine = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint = geomDataAPI_Point2D(
     aSketchLine.data().attribute("StartPoint"))
 aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.data().attribute("EndPoint"))
@@ -79,8 +77,7 @@ aSession.finishOperation()
 #=========================================================================
 assert (distance(aSketchPointCoords, aLineAStartPoint) != 25.)
 aSession.startOperation()
-aConstraint = aDocument.addFeature("SketchConstraintDistance")
-aSketchReflist.append(aConstraint)
+aConstraint = aSketchFeature.addFeature("SketchConstraintDistance")
 aConstraintData = aConstraint.data()
 aDistance = aConstraintData.real("ConstraintValue")
 refattrA = aConstraintData.refattr("ConstraintEntityA")
index 28f032e4ad309da415c1e6b4fd1ed1e5e25530cc..b4872a6b170760caf17675e82bbcbb59e1f1ebb8 100644 (file)
@@ -15,7 +15,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -23,7 +23,8 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
 origin.setValue(0, 0, 0)
@@ -38,9 +39,7 @@ aSession.finishOperation()
 # Create a line with length 100
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
-aSketchLineA = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLineA)
+aSketchLineA = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint = geomDataAPI_Point2D(
     aSketchLineA.data().attribute("StartPoint"))
 aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.data().attribute("EndPoint"))
@@ -51,8 +50,7 @@ aSession.finishOperation()
 # Make a constraint to keep the length
 #=========================================================================
 aSession.startOperation()
-aLengthConstraint = aDocument.addFeature("SketchConstraintLength")
-aSketchReflist.append(aLengthConstraint)
+aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength")
 aConstraintData = aLengthConstraint.data()
 refattrA = aConstraintData.refattr("ConstraintEntityA")
 aLength = aConstraintData.real("ConstraintValue")
index aa244cee7ab3d08a016b464dbf6cf6a4068d130d..cf9a3fb8bc4abe6c41356624b9b75d6a2fb05d61 100644 (file)
@@ -15,7 +15,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -23,7 +23,8 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
 origin.setValue(0, 0, 0)
@@ -38,19 +39,16 @@ aSession.finishOperation()
 # Create two lines which are not parallel
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
 # line A
-aSketchLineA = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLineA)
+aSketchLineA = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint = geomDataAPI_Point2D(
     aSketchLineA.data().attribute("StartPoint"))
 aLineAEndPoint = geomDataAPI_Point2D(
     aSketchLineA.data().attribute("EndPoint"))
-aSketchLineB = aDocument.addFeature("SketchLine")
+aSketchLineB = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint.setValue(0., 25)
 aLineAEndPoint.setValue(85., 25)
 # line B
-aSketchReflist.append(aSketchLineB)
 aLineBStartPoint = geomDataAPI_Point2D(
     aSketchLineB.data().attribute("StartPoint"))
 aLineBEndPoint = geomDataAPI_Point2D(
@@ -64,8 +62,7 @@ aSession.finishOperation()
 #=========================================================================
 for eachFeature in [aSketchLineA, aSketchLineB]:
     aSession.startOperation()
-    aLengthConstraint = aDocument.addFeature("SketchConstraintLength")
-    aSketchReflist.append(aLengthConstraint)
+    aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength")
     aLengthConstraintData = aLengthConstraint.data()
     refattrA = aLengthConstraintData.refattr("ConstraintEntityA")
     aResultA = modelAPI_ResultConstruction(eachFeature.firstResult())
@@ -86,8 +83,7 @@ assert (aLineBEndPoint.y() == 75)
 # Link lines with parallel constraint
 #=========================================================================
 aSession.startOperation()
-aParallelConstraint = aDocument.addFeature("SketchConstraintParallel")
-aSketchReflist.append(aParallelConstraint)
+aParallelConstraint = aSketchFeature.addFeature("SketchConstraintParallel")
 aConstraintData = aParallelConstraint.data()
 refattrA = aConstraintData.refattr("ConstraintEntityA")
 refattrB = aConstraintData.refattr("ConstraintEntityB")
index 192f1d9ac12078f44d72a074f72b79d1157d54af..b6aff2963e104795e01f763e3a19e0307a791a8e 100644 (file)
@@ -22,7 +22,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -30,7 +30,8 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
 origin.setValue(0, 0, 0)
@@ -45,19 +46,16 @@ aSession.finishOperation()
 # Create two lines which are already perpendicular
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
 # line A
-aSketchLineA = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLineA)
+aSketchLineA = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint = geomDataAPI_Point2D(
     aSketchLineA.data().attribute("StartPoint"))
 aLineAEndPoint = geomDataAPI_Point2D(
     aSketchLineA.data().attribute("EndPoint"))
-aSketchLineB = aDocument.addFeature("SketchLine")
+# line B
+aSketchLineB = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint.setValue(0., 25)
 aLineAEndPoint.setValue(85., 25)
-# line B
-aSketchReflist.append(aSketchLineB)
 aLineBStartPoint = geomDataAPI_Point2D(
     aSketchLineB.data().attribute("StartPoint"))
 aLineBEndPoint = geomDataAPI_Point2D(
@@ -72,8 +70,7 @@ aSession.finishOperation()
 
 for eachFeature in [aSketchLineA, aSketchLineB]:
     aSession.startOperation()
-    aLengthConstraint = aDocument.addFeature("SketchConstraintLength")
-    aSketchReflist.append(aLengthConstraint)
+    aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength")
     aLengthConstraintData = aLengthConstraint.data()
     refattrA = aLengthConstraintData.refattr("ConstraintEntityA")
     aResultA = modelAPI_ResultConstruction(eachFeature.firstResult())
@@ -95,9 +92,8 @@ assert (aLineBEndPoint.y() == 125)
 # Link lines with perpendicular constraint
 #=========================================================================
 aSession.startOperation()
-aPerpendicularConstraint = aDocument.addFeature(
+aPerpendicularConstraint = aSketchFeature.addFeature(
     "SketchConstraintPerpendicular")
-aSketchReflist.append(aPerpendicularConstraint)
 aConstraintData = aPerpendicularConstraint.data()
 refattrA = aConstraintData.refattr("ConstraintEntityA")
 refattrB = aConstraintData.refattr("ConstraintEntityB")
index 630beb124a11f53709ffe9de1d9837628666e389..2623047ca2f7f8bc3b72a3d4a0ce4f0eec582686 100644 (file)
@@ -24,7 +24,7 @@ import math
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -32,7 +32,8 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
 origin.setValue(0, 0, 0)
@@ -47,9 +48,7 @@ aSession.finishOperation()
 # Creation of an arc and a circle
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
-aSketchArc = aDocument.addFeature("SketchArc")
-aSketchReflist.append(aSketchArc)
+aSketchArc = aSketchFeature.addFeature("SketchArc")
 aSketchArcData = aSketchArc.data()
 anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter"))
 anArcCentr.setValue(10., 10.)
@@ -61,8 +60,7 @@ anArcEndPoint.setValue(50., 0.)
 aSession.finishOperation()
 # Circle
 aSession.startOperation()
-aSketchCircle = aDocument.addFeature("SketchCircle")
-aSketchReflist.append(aSketchCircle)
+aSketchCircle = aSketchFeature.addFeature("SketchCircle")
 aSketchCircleData = aSketchCircle.data()
 anCircleCentr = geomDataAPI_Point2D(
     aSketchCircleData.attribute("CircleCenter"))
@@ -74,8 +72,7 @@ aSession.finishOperation()
 # Make a constraint to keep the radius of the arc
 #=========================================================================
 aSession.startOperation()
-aConstraint = aDocument.addFeature("SketchConstraintRadius")
-aSketchReflist.append(aConstraint)
+aConstraint = aSketchFeature.addFeature("SketchConstraintRadius")
 aConstraintData = aConstraint.data()
 aRadius = aConstraintData.real("ConstraintValue")
 aRefObject = aConstraintData.refattr("ConstraintEntityA")
@@ -90,8 +87,7 @@ assert (aRefObject.isInitialized())
 # Make a constraint to keep the radius of the circle
 #=========================================================================
 aSession.startOperation()
-aConstraint = aDocument.addFeature("SketchConstraintRadius")
-aSketchReflist.append(aConstraint)
+aConstraint = aSketchFeature.addFeature("SketchConstraintRadius")
 aConstraintData = aConstraint.data()
 aRadius = aConstraintData.real("ConstraintValue")
 aRefObject = aConstraintData.refattr("ConstraintEntityA")
index 4223d5c35d104583365f346c354538e8d3a2a320..cde34109ec348b473971251101d54e4f2e17b0ce 100644 (file)
@@ -22,7 +22,7 @@
 from GeomDataAPI import *
 from ModelAPI import *
 
-__updated__ = "2014-07-25"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -30,7 +30,9 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+#aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
 origin.setValue(0, 0, 0)
@@ -44,23 +46,23 @@ aSession.finishOperation()
 #=========================================================================
 # Creation of an arc
 # 1. Test SketchPlugin_Arc attributes
-# 2. 
+# 2.
 #=========================================================================
 aSession.startOperation()
 aSketchReflist = aSketchFeatureData.reflist("Features")
 assert (not aSketchReflist.isInitialized())
 assert (aSketchReflist.size() == 0)
 assert (len(aSketchReflist.list()) == 0)
-aSketchArc = aDocument.addFeature("SketchArc")
+aSketchArc = aSketchFeature.addFeature("SketchArc")
 assert (aSketchArc.getKind() == "SketchArc")
-aSketchReflist.append(aSketchArc)
 aSketchArcData = aSketchArc.data()
 anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter"))
 assert (anArcCentr.x() == 0)
 assert (anArcCentr.y() == 0)
 assert (not anArcCentr.isInitialized())
-anArcCentr.setValue(10.,10.)
-anArcStartPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcStartPoint"))
+anArcCentr.setValue(10., 10.)
+anArcStartPoint = geomDataAPI_Point2D(
+    aSketchArcData.attribute("ArcStartPoint"))
 assert (anArcStartPoint.x() == 0)
 assert (anArcStartPoint.y() == 0)
 assert (not anArcStartPoint.isInitialized())
@@ -81,15 +83,16 @@ assert (anArcStartPoint.x() == 0.0)
 assert (anArcStartPoint.y() == 50.0)
 assert (anArcEndPoint.x() == 50.0)
 assert (anArcEndPoint.y() == 0.0)
-#===============================================================================
+#=========================================================================
 # Edit the arc:
 # 1. Move whole arc
-# 2. Change the start point 
-#===============================================================================
+# 2. Change the start point
+#=========================================================================
 aSession.startOperation()
 deltaX, deltaY = 5., 10.
 anArcCentr.setValue(anArcCentr.x() + deltaX, anArcCentr.y() + deltaY)
-anArcStartPoint.setValue(anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY)
+anArcStartPoint.setValue(
+    anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY)
 anArcEndPoint.setValue(anArcEndPoint.x() + deltaX, anArcEndPoint.y() + deltaY)
 aSession.finishOperation()
 assert (anArcCentr.x() == 15)
@@ -111,32 +114,32 @@ assert (anArcStartPoint.y() == 60)
 assert (anArcEndPoint.x() != aPrevEndPointX)
 assert (anArcEndPoint.y() != aPrevEndPointY)
 #=========================================================================
-# Check results of the Arc 
+# Check results of the Arc
 #=========================================================================
 aResult = aSketchArc.firstResult()
 aResultConstruction = modelAPI_ResultConstruction(aResult)
 aShape = aResultConstruction.shape()
 assert (aShape is not None)
 assert (not aShape.isNull())
-#===============================================================================
+#=========================================================================
 # Create a circle
 # 1. Test SketchPlugin_Circle.h attributes
 # 2. ModelAPI_AttributeDouble attribute
-#===============================================================================
+#=========================================================================
 aSession.startOperation()
 aSketchReflist = aSketchFeatureData.reflist("Features")
 # Arc is already added
 assert (aSketchReflist.size() == 1)
 assert (len(aSketchReflist.list()) == 1)
-aSketchCircle = aDocument.addFeature("SketchCircle")
+aSketchCircle = aSketchFeature.addFeature("SketchCircle")
 assert (aSketchCircle.getKind() == "SketchCircle")
-aSketchReflist.append(aSketchCircle)
 aSketchCircleData = aSketchCircle.data()
-anCircleCentr = geomDataAPI_Point2D(aSketchCircleData.attribute("CircleCenter"))
+anCircleCentr = geomDataAPI_Point2D(
+    aSketchCircleData.attribute("CircleCenter"))
 assert (anCircleCentr.x() == 0)
 assert (anCircleCentr.y() == 0)
 assert (not anCircleCentr.isInitialized())
-aCircleRadius = aSketchCircleData.real("CircleRadius");
+aCircleRadius = aSketchCircleData.real("CircleRadius")
 assert (type(aCircleRadius) == ModelAPI_AttributeDouble)
 # ModelAPI_AttributeDouble.type() is checked in ModelAPI_TestConstants
 assert (aCircleRadius.attributeType() == ModelAPI_AttributeDouble.type())
@@ -147,11 +150,11 @@ assert (anCircleCentr.x() == -25)
 assert (anCircleCentr.y() == -25)
 assert (aCircleRadius.value() == 25)
 aSession.finishOperation()
-#===============================================================================
+#=========================================================================
 # Edit the Cricle
 # 1. Check that changing the centr of a circle does not affects radius
 # 2. and vise versa; also check that int is acceptable as well as a real
-#===============================================================================
+#=========================================================================
 aSession.startOperation()
 anCircleCentr.setValue(10, 60)
 aSession.finishOperation()
@@ -164,6 +167,6 @@ aSession.finishOperation()
 assert (anCircleCentr.x() == 10)
 assert (anCircleCentr.y() == 60)
 assert (aCircleRadius.value() == 20)
-#===============================================================================
+#=========================================================================
 # End of test
-#===============================================================================
+#=========================================================================
index dd90e27fd7df9ed05f8b921f913b93e5fb2b63da..20a85e3dad8b73ef4496d2a628bbc7b6c63873e7 100644 (file)
@@ -4,7 +4,7 @@
 from GeomDataAPI import *
 from ModelAPI import *
 
-__updated__ = "2014-07-24"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -12,7 +12,8 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 assert (aSketchFeature.getKind() == "Sketch")
 aSketchFeatureData = aSketchFeature.data()
 origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
@@ -49,9 +50,9 @@ aSketchReflist = aSketchFeatureData.reflist("Features")
 assert (not aSketchReflist.isInitialized())
 assert(aSketchReflist.size() == 0)
 assert (len(aSketchReflist.list()) == 0)
-aSketchPoint = aDocument.addFeature("SketchPoint")
+# aSketchPoint = aDocument.addFeature("SketchPoint")
+aSketchPoint = aSketchFeature.addFeature("SketchPoint")
 assert (aSketchPoint.getKind() == "SketchPoint")
-aSketchReflist.append(aSketchPoint)
 aSketchPointData = aSketchPoint.data()
 coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates"))
 assert (coords.x() == 0)
@@ -69,18 +70,18 @@ aSketchPointData = aSketchPoint.data()
 coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates"))
 assert (coords.x() == 10.0)
 assert (coords.y() == 10.0)
-#===============================================================================
+#=========================================================================
 # Creation of a line
-#===============================================================================
+#=========================================================================
 aSession.startOperation()
-aSketchLine = aDocument.addFeature("SketchLine")
+# aSketchLine = aDocument.addFeature("SketchLine")
+aSketchLine = aSketchFeature.addFeature("SketchLine")
 assert (aSketchLine.getKind() == "SketchLine")
-aSketchReflist.append(aSketchLine)
 assert (aSketchReflist.size() == 2)
 assert (len(aSketchReflist.list()) == 2)
 aSketchLineData = aSketchLine.data()
 aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint"))
-aLineEndPoint= geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
+aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
 assert (aLineStartPoint.x() == 0)
 assert (aLineStartPoint.y() == 0)
 assert (not aLineStartPoint.isInitialized())
@@ -96,15 +97,16 @@ aSession.finishOperation()
 # check that values have been changed
 aSketchLineData = aSketchLine.data()
 aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint"))
-aLineEndPoint= geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
+aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
 assert (aLineStartPoint.x() == 50.0)
 assert (aLineStartPoint.y() == 50.0)
 assert (aLineEndPoint.x() == 60.0)
 assert (aLineEndPoint.y() == 60.0)
-#===============================================================================
+#=========================================================================
 # Check the results
-#===============================================================================
+#=========================================================================
 aResult = aSketchLine.firstResult()
+assert (aResult is not None)
 aResultConstruction = modelAPI_ResultConstruction(aResult)
 aShape = aResultConstruction.shape()
 assert (aShape is not None)