From: azv Date: Sun, 7 Nov 2021 20:33:06 +0000 (+0300) Subject: [bos #26444] Fix tests for importing parameters file and python dump X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1a33eedc99c0c298cf999d3bcb184e826a93d460;p=modules%2Fshaper.git [bos #26444] Fix tests for importing parameters file and python dump --- diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 6110bf89e..09900d6b8 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -1275,7 +1275,14 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( const std::shared_ptr& 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; } diff --git a/src/ParametersPlugin/Test/TestImportInvalidParameters.py b/src/ParametersPlugin/Test/TestImportInvalidParameters.py index 9faf17069..61b9751d1 100644 --- a/src/ParametersPlugin/Test/TestImportInvalidParameters.py +++ b/src/ParametersPlugin/Test/TestImportInvalidParameters.py @@ -18,15 +18,7 @@ # 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()) diff --git a/src/ParametersPlugin/Test/TestImportParameters.py b/src/ParametersPlugin/Test/TestImportParameters.py index 0a17a0f24..29fbf7f68 100644 --- a/src/ParametersPlugin/Test/TestImportParameters.py +++ b/src/ParametersPlugin/Test/TestImportParameters.py @@ -20,14 +20,6 @@ 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()