]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[bos #26444] Fix tests for importing parameters file and python dump CR26444
authorazv <azv@opencascade.com>
Sun, 7 Nov 2021 20:33:06 +0000 (23:33 +0300)
committerazv <azv@opencascade.com>
Sun, 7 Nov 2021 20:33:06 +0000 (23:33 +0300)
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ParametersPlugin/Test/TestImportInvalidParameters.py
src/ParametersPlugin/Test/TestImportParameters.py

index 6110bf89eaf54bc0d38b66806e523f489470aa09..09900d6b8ce84ee5fc33821ba52d8041693bf884 100644 (file)
@@ -1275,7 +1275,14 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
 ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
     const std::shared_ptr<ModelAPI_AttributeString>& theAttrStr)
 {
-  *myDumpStorage << "\"" << theAttrStr->value() << "\"";
+  // escaping the quote sign in the string under dumping
+  std::string aStr = theAttrStr->value();
+  size_t aPos = aStr.find("\"");
+  while (aPos != std::string::npos) {
+    aStr.insert(aPos, "\\");
+    aPos = aStr.find("\"", aPos + 2);
+  }
+  *myDumpStorage << "'" << aStr << "'";
   return *this;
 }
 
index 9faf17069f84bc2d6c402dfd92e1473d4b37e605..61b9751d11f0e9ae8665109d54740181a35a8f3b 100644 (file)
 #
 
 from salome.shaper import model
-import inspect, os, sys
-
-from PyQt5.Qt import QApplication
-
-import salome
-salome.salome_init_without_session()
-salome.salome_init(1)
-if QApplication.instance() is None:
-  app = QApplication([])
+import inspect, os
 
 data_dir = os.path.join(os.path.dirname(inspect.getfile(lambda: None)), "data")
 
@@ -42,4 +34,3 @@ aDir = os.path.join(data_dir, nameFile)
 aListOfParameters = model.importParameters(Part_1_doc, aDir)
 
 assert(len(aListOfParameters) == 0)
-assert(model.checkPythonDump())
index 0a17a0f240b0098fb962fe591e55622a5e7fb22a..29fbf7f68635a7f963533c08d9504fa3c074609c 100644 (file)
 from salome.shaper import model
 import inspect, os
 
-from PyQt5.Qt import QApplication
-
-import salome
-salome.salome_init_without_session()
-salome.salome_init(1)
-if QApplication.instance() is None:
-  app = QApplication([])
-
 data_dir = os.path.join(os.path.dirname(inspect.getfile(lambda: None)), "data")
 
 model.begin()