]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix TestSketcherSetCoincident::test_none_type_arguments test
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 9 Jun 2016 13:54:13 +0000 (16:54 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:05 +0000 (14:41 +0300)
src/ModelHighAPI/ModelHighAPI.i
src/PythonAPI/Test/TestSketcherSetCoincident.py

index 30bb59da35246e02bc326bc065ac6813e9f73c26..44a3675a827df452dea08e17090485df98567362 100644 (file)
   std::shared_ptr<ModelAPI_Object> * temp_object;
   int newmem = 0;
   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+    if (!temp_attribute) {
+      PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelAPI_Attribute, int or ModelAPI_Object.");
+      return NULL;
+    }
     temp = ModelHighAPI_RefAttr(*temp_attribute);
     if (newmem & SWIG_CAST_NEW_MEMORY) {
       delete temp_attribute;
     $1 = &temp;
   } else
   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+    if (!temp_object) {
+      PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelAPI_Attribute, int or ModelAPI_Object.");
+      return NULL;
+    }
     temp = ModelHighAPI_RefAttr(*temp_object);
     if (newmem & SWIG_CAST_NEW_MEMORY) {
       delete temp_object;
index 09518cf8008ee52e14d977e3e34537b69e9dbbdd..a964e59a942a17c695ba463b0ea69dba7f9020d7 100644 (file)
@@ -9,10 +9,10 @@ class SketcherSetCoincident(SketcherTestCase):
         self.sketch.setCoincident(l1.endPoint(), l2.startPoint())
         model.do()
 
-    def test_none_type_arguments(self):
-        l2 = self.sketch.addLine(0, 1, 1, 1)
-        with self.assertRaises(TypeError):
-            self.sketch.setCoincident(None, l2.startPoint())
+    def test_none_type_arguments(self):
+        l2 = self.sketch.addLine(0, 1, 1, 1)
+        with self.assertRaises(TypeError):
+            self.sketch.setCoincident(None, l2.startPoint())
 
     def test_empty_arguments(self):
         l1 = self.sketch.addLine(0, 0, 0, 1)