[Libreoffice-commits] core.git: sw/qa

Justn Lavoie jlavoie1602 at gmail.com
Tue Jan 3 00:02:41 UTC 2017


 sw/qa/python/load_save_test.py |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 6cea397a95dab91ebf37f25e443393c22da065f7
Author: Justn Lavoie <jlavoie1602 at gmail.com>
Date:   Thu Dec 29 19:49:27 2016 -0500

    tdf#97361 Use join() for string concatenation
    
    The PEP8 suggest to use join() instead of + operator for string concatenation.
    
    Change-Id: I35325cc73845a450f5c8ce40b7594e6d57ad6f45
    Reviewed-on: https://gerrit.libreoffice.org/32504
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sw/qa/python/load_save_test.py b/sw/qa/python/load_save_test.py
index 527184e..a79bc32 100644
--- a/sw/qa/python/load_save_test.py
+++ b/sw/qa/python/load_save_test.py
@@ -73,20 +73,17 @@ class LoadSaveTest(unittest.TestCase):
 
             filepath = os.path.abspath("FIXME")
             if os.name == "nt":
-                source_file = "file:///" + filepath + "/" + quote(self.file_name)
+                source_file = ''.join(("file:///", filepath, "/", quote(self.file_name)))
             else:
-                source_file = "file://" + quote(filepath) + "/" + quote(self.file_name)
+                source_file = ''.join(("file://", quote(filepath), "/", quote(self.file_name)))
+
             self.xDoc = desktop.loadComponentFromURL(source_file, "_blank", 0, load_props)
             assert(self.xDoc)
 
             if os.name == "nt":
-                target_file = "file:///" + self.m_TargetDir + quote(self.m_SourceDir) + "/" + quote(self.file_name)
+                target_file = ''.join(("file:///", self.m_TargetDir, quote(self.m_SourceDir), "/", quote(self.file_name)))
             else:
-                target_file = "file://" +
-                            quote(self.m_TargetDir) +
-                            quote(self.m_SourceDir) +
-                            "/" +
-                            quote(self.fileName)
+                target_file = ''.join(("file://", quote(self.m_TargetDir), quote(self.m_SourceDir), "/", quote(self.fileName)))
 
             p1 = PropertyValue()
             PropValue = uno.Any("[]com.sun.star.beans.PropertyValue", (p1,))
@@ -98,7 +95,8 @@ class LoadSaveTest(unittest.TestCase):
     def getDirAndFile(self, dir):
 
         root2 = os.mkdir(dir)
-        root = open(dir + "/" + dir + ".odt", 'a')
+        root_path = ''.join((dir, "/", dir, ".odt"))
+        root = open(root_path, 'a')
 
         self.getDirAndFileNames(dir)
         return self.dirs, self.files
@@ -129,5 +127,6 @@ class LoadSaveTest(unittest.TestCase):
                 f = os.mkdir(target + dir)
                 self.assertTrue(os.path.exists(target + dir))
 
-        root = open(target + dir + "/" + self.m_SourceDir + ".odt", 'a')
-        filepath = os.path.abspath(target + dir + "/" + self.m_SourceDir + ".odt")
+        target_path = ''.join((target, dir, "/", self.m_SourceDir, ".odt"))
+        root = open(target_path, 'a')
+        filepath = os.path.abspath(target_path)


More information about the Libreoffice-commits mailing list