summaryrefslogtreecommitdiff
path: root/sw/qa/python
diff options
context:
space:
mode:
authorackepenek <ahmetcan.kepenek@gmail.com>2016-04-08 19:48:52 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-11 07:25:11 +0000
commit79e68375e48303ae1a36a0a61814cdb87cca3415 (patch)
tree4bd809797d5217eeff573b71d10feeb91dcc1229 /sw/qa/python
parent63ba54a168dbc777cdcec2393be476bdd5f79bc1 (diff)
tdf#99145 refactored to pep8
Change-Id: I4896cd0bda97331a8291588e6a4f29a881d1229c Reviewed-on: https://gerrit.libreoffice.org/23925 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw/qa/python')
-rw-r--r--sw/qa/python/check_cross_references.py147
-rw-r--r--sw/qa/python/check_fields.py1
-rw-r--r--sw/qa/python/check_flies.py26
-rw-r--r--sw/qa/python/check_index.py24
-rw-r--r--sw/qa/python/check_indexed_property_values.py16
-rw-r--r--sw/qa/python/check_named_property_values.py8
-rw-r--r--sw/qa/python/check_styles.py9
-rw-r--r--sw/qa/python/check_table.py123
-rw-r--r--sw/qa/python/get_expression.py2
-rw-r--r--sw/qa/python/load_save_test.py17
-rw-r--r--sw/qa/python/set_expression.py4
-rw-r--r--sw/qa/python/var_fields.py20
12 files changed, 201 insertions, 196 deletions
diff --git a/sw/qa/python/check_cross_references.py b/sw/qa/python/check_cross_references.py
index 5ec1bc8639f0..687a5e8e385f 100644
--- a/sw/qa/python/check_cross_references.py
+++ b/sw/qa/python/check_cross_references.py
@@ -1,12 +1,12 @@
'''
This file is part of the LibreOffice project.
-
+
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
+
This file incorporates work covered by the following license notice:
-
+
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright
@@ -34,6 +34,7 @@ from com.sun.star.text.ReferenceFieldSource import BOOKMARK
from com.sun.star.text.ReferenceFieldPart import TEXT
from org.libreoffice.unotest import UnoInProcess
+
class CheckCrossReferences(unittest.TestCase):
@classmethod
@@ -42,61 +43,60 @@ class CheckCrossReferences(unittest.TestCase):
cls._uno.setUp()
cls.document = cls._uno.openWriterTemplateDoc("CheckCrossReferences.odt")
cls.xParaEnum = None
- cls.xPortionEnum= None
- cls.xFieldsRefresh= None
+ cls.xPortionEnum = None
+ cls.xFieldsRefresh = None
@classmethod
def tearDownClass(cls):
cls._uno.tearDown()
-
def getNextField(self):
while True:
- while self.xPortionEnum == None:
+ while self.xPortionEnum is None:
if (not(self.xParaEnum.hasMoreElements())):
self.fail("Cannot retrieve next field.")
aPara = self.xParaEnum.nextElement()
self.xPortionEnum = aPara.createEnumeration()
- if ( self.xPortionEnum == None ):
+ if (self.xPortionEnum is None):
break
while self.xPortionEnum.hasMoreElements():
xPortionProps = self.xPortionEnum.nextElement()
- sPortionType = str(xPortionProps.getPropertyValue( "TextPortionType" ))
- if ( sPortionType == "TextField" ):
- xField = xPortionProps.getPropertyValue( "TextField" )
- self.assertTrue(xField) #Cannot retrieve next field
+ sPortionType = str(xPortionProps.getPropertyValue("TextPortionType"))
+ if (sPortionType == "TextField"):
+ xField = xPortionProps.getPropertyValue("TextField")
+ self.assertTrue(xField) # Cannot retrieve next field
return xField
self.xPortionEnum = None
- return None #unreachable
+ return None # unreachable
- def getFieldProps(self,xField):
+ def getFieldProps(self, xField):
xProps = xField
self.assertTrue(xProps, "Cannot retrieve field properties.")
return xProps
- def checkField(self, xField , xProps, nFormat, aExpectedFieldResult ):
+ def checkField(self, xField, xProps, nFormat, aExpectedFieldResult):
# set requested format
xProps.setPropertyValue("ReferenceFieldPart", int(nFormat))
# refresh fields in order to get new format applied
self.xFieldsRefresh.refresh()
aFieldResult = xField.getPresentation(False)
- self.assertEqual(aExpectedFieldResult, aFieldResult) #set reference field format doesn't result in correct field result
+ self.assertEqual(aExpectedFieldResult, aFieldResult) # set reference field format doesn't result in correct field result
def test_checkCrossReferences(self):
xParaEnumAccess = self.document.getText()
- self.xParaEnum = xParaEnumAccess.createEnumeration();
+ self.xParaEnum = xParaEnumAccess.createEnumeration()
- #get field refresher
+ # get field refresher
xFieldSupp = self.__class__.document
self.xFieldsRefresh = xFieldSupp.getTextFields()
- #check first reference field
- #strings for checking
+ # check first reference field
+ # strings for checking
FieldResult1 = "*i*"
FieldResult2 = "+b+*i*"
FieldResult3 = "-1-+b+*i*"
@@ -110,79 +110,79 @@ class CheckCrossReferences(unittest.TestCase):
FieldResult11 = "(b)"
FieldResult12 = "(a)"
- #variables for current field
+ # variables for current field
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult2 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult1 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult3 )
+ self.checkField(xField, xProps, NUMBER, FieldResult2)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult1)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult3)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult1 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult1 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult3 )
+ self.checkField(xField, xProps, NUMBER, FieldResult1)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult1)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult3)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult3 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult1 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult3 )
+ self.checkField(xField, xProps, NUMBER, FieldResult3)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult1)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult3)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult5 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult4 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult6 )
+ self.checkField(xField, xProps, NUMBER, FieldResult5)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult4)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult6)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult4 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult4 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult6 )
+ self.checkField(xField, xProps, NUMBER, FieldResult4)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult4)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult6)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult6 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult4 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult6 )
+ self.checkField(xField, xProps, NUMBER, FieldResult6)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult4)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult6)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult7 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult12 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult7 )
+ self.checkField(xField, xProps, NUMBER, FieldResult7)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult12)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult7)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult8 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult11 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult8 )
+ self.checkField(xField, xProps, NUMBER, FieldResult8)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult11)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult8)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult9 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult9 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult9 )
+ self.checkField(xField, xProps, NUMBER, FieldResult9)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult9)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult9)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult4 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult4 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult4 )
+ self.checkField(xField, xProps, NUMBER, FieldResult4)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult4)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult4)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult10 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult12 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult10 )
+ self.checkField(xField, xProps, NUMBER, FieldResult10)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult12)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult10)
xField = self.getNextField()
xProps = self.getFieldProps(xField)
- self.checkField( xField, xProps, NUMBER, FieldResult12 )
- self.checkField( xField, xProps, NUMBER_NO_CONTEXT, FieldResult12 )
- self.checkField( xField, xProps, NUMBER_FULL_CONTEXT, FieldResult7 )
+ self.checkField(xField, xProps, NUMBER, FieldResult12)
+ self.checkField(xField, xProps, NUMBER_NO_CONTEXT, FieldResult12)
+ self.checkField(xField, xProps, NUMBER_FULL_CONTEXT, FieldResult7)
- #insert a certain cross-reference bookmark and a reference field to this bookmark
+ # insert a certain cross-reference bookmark and a reference field to this bookmark
# restart paragraph enumeration
xParaEnumAccess = self.__class__.document.getText()
self.xParaEnum = xParaEnumAccess.createEnumeration()
@@ -191,44 +191,43 @@ class CheckCrossReferences(unittest.TestCase):
while self.xParaEnum.hasMoreElements():
xParaTextRange = self.xParaEnum.nextElement()
- if xParaTextRange.getString() == "J" :
+ if xParaTextRange.getString() == "J":
break
else:
xParaTextRange = None
- self.assertTrue(xParaTextRange) #Cannot find paragraph to insert cross-reference bookmark
+ self.assertTrue(xParaTextRange) # Cannot find paragraph to insert cross-reference bookmark
- #insert bookmark
+ # insert bookmark
xFac = self.__class__.document
cBookmarkName = "__RefNumPara__47114711"
- xBookmark = xFac.createInstance( "com.sun.star.text.Bookmark" )
+ xBookmark = xFac.createInstance("com.sun.star.text.Bookmark")
- if xBookmark != None:
+ if xBookmark is not None:
xName = xBookmark
- xName.setName( cBookmarkName )
+ xName.setName(cBookmarkName)
xBookmark.attach(xParaTextRange.getStart())
# insert reference field, which references the inserted bookmark
- xNewField = xFac.createInstance( "com.sun.star.text.TextField.GetReference" )
+ xNewField = xFac.createInstance("com.sun.star.text.TextField.GetReference")
- if xNewField != None:
+ if xNewField is not None:
xFieldProps = xNewField
- xFieldProps.setPropertyValue( "ReferenceFieldPart", int(TEXT))
- xFieldProps.setPropertyValue( "ReferenceFieldSource", int(BOOKMARK))
- xFieldProps.setPropertyValue( "SourceName", cBookmarkName )
+ xFieldProps.setPropertyValue("ReferenceFieldPart", int(TEXT))
+ xFieldProps.setPropertyValue("ReferenceFieldSource", int(BOOKMARK))
+ xFieldProps.setPropertyValue("SourceName", cBookmarkName)
xFieldTextRange = self.xParaEnum.nextElement()
xNewField.attach(xFieldTextRange.getEnd())
self.xFieldsRefresh.refresh()
- #check inserted reference field
+ # check inserted reference field
xField = xNewField
- self.assertEqual("J", xField.getPresentation(False)) #inserted reference field doesn't has correct field result
+ self.assertEqual("J", xField.getPresentation(False)) # inserted reference field doesn't has correct field result
- xParaTextRange.getStart().setString( "Hallo new bookmark: ")
+ xParaTextRange.getStart().setString("Hallo new bookmark: ")
self.xFieldsRefresh.refresh()
- self.assertEqual("Hallo new bookmark: J", xField.getPresentation(False)) #inserted reference field doesn't has correct field result
+ self.assertEqual("Hallo new bookmark: J", xField.getPresentation(False)) # inserted reference field doesn't has correct field result
if __name__ == "__main__":
unittest.main()
-
diff --git a/sw/qa/python/check_fields.py b/sw/qa/python/check_fields.py
index 5a3c2b74f0fc..f6c869217aeb 100644
--- a/sw/qa/python/check_fields.py
+++ b/sw/qa/python/check_fields.py
@@ -1,6 +1,7 @@
import unittest
from org.libreoffice.unotest import UnoInProcess
+
class CheckFields(unittest.TestCase):
_uno = None
_xDoc = None
diff --git a/sw/qa/python/check_flies.py b/sw/qa/python/check_flies.py
index d03100d2876c..b73da3c61cd5 100644
--- a/sw/qa/python/check_flies.py
+++ b/sw/qa/python/check_flies.py
@@ -29,6 +29,7 @@ import unittest
import unohelper
import os
+
class CheckFlies(unittest.TestCase):
@classmethod
@@ -37,7 +38,6 @@ class CheckFlies(unittest.TestCase):
cls._uno.setUp()
cls.document = cls._uno.openWriterTemplateDoc("CheckFlies.odt")
-
@classmethod
def tearDownClass(cls):
cls._uno.tearDown()
@@ -54,21 +54,22 @@ class CheckFlies(unittest.TestCase):
vExpectedEmbeddedFrames = ["Object1"]
nEmbeddedFrames = len(vExpectedEmbeddedFrames)
xEmbeddedFrames = xTGOS.getEmbeddedObjects()
- nCurrentFrameIdx=0
+ nCurrentFrameIdx = 0
print (xEmbeddedFrames)
for sFrameName in xEmbeddedFrames.getElementNames():
vExpectedEmbeddedFrames.remove(sFrameName)
- # raises ValueError if not found
+ # raises ValueError if not found
print (sFrameName)
xEmbeddedFrames.getByName(sFrameName)
- self.assertTrue(xEmbeddedFrames.hasByName(sFrameName), "Could not find embedded frame by name.")
+ self.assertTrue(xEmbeddedFrames.hasByName(sFrameName),
+ "Could not find embedded frame by name.")
self.assertTrue(not(vExpectedEmbeddedFrames), "Missing expected embedded frames.")
xEmbeddedFramesIdx = xEmbeddedFrames
- self.assertEqual(nEmbeddedFrames, xEmbeddedFramesIdx.getCount()) #Unexpected number of embedded frames reported
+ self.assertEqual(nEmbeddedFrames, xEmbeddedFramesIdx.getCount()) # Unexpected number of embedded frames reported
for nCurrentFrameIdx in range(xEmbeddedFramesIdx.getCount()):
xEmbeddedFramesIdx.getByIndex(nCurrentFrameIdx)
@@ -80,7 +81,7 @@ class CheckFlies(unittest.TestCase):
nCurrentFrameIdx = 0
for sFrameName in xGraphicFrames.getElementNames():
vExpectedGraphicFrames.remove(sFrameName)
- # raises ValueError if not found
+ # raises ValueError if not found
xGraphicFrames.getByName(sFrameName)
self.assertTrue(
xGraphicFrames.hasByName(sFrameName),
@@ -90,20 +91,20 @@ class CheckFlies(unittest.TestCase):
"Missing expected graphics frames.")
xGraphicFramesIdx = xGraphicFrames
- self.assertEqual(nGraphicFrames,xGraphicFramesIdx.getCount()) #Unexpected number of graphics frames reported
+ self.assertEqual(nGraphicFrames, xGraphicFramesIdx.getCount()) # Unexpected number of graphics frames reported
for nCurrentFrameIdx in range(xGraphicFramesIdx.getCount()):
- xGraphicFramesIdx.getByIndex(nCurrentFrameIdx);
+ xGraphicFramesIdx.getByIndex(nCurrentFrameIdx)
def checkTextFrames(self, xTFS):
- vExpectedTextFrames= ["Frame1" , "Frame2"]
+ vExpectedTextFrames = ["Frame1", "Frame2"]
nTextFrames = len(vExpectedTextFrames)
xTextFrames = xTFS.getTextFrames()
- nCurrentFrameIdx=0
+ nCurrentFrameIdx = 0
for sFrameName in xTextFrames.getElementNames():
vExpectedTextFrames.remove(sFrameName)
- # raises ValueError if not found
+ # raises ValueError if not found
xTextFrames.getByName(sFrameName)
self.assertTrue(
xTextFrames.hasByName(sFrameName),
@@ -114,7 +115,7 @@ class CheckFlies(unittest.TestCase):
xTextFramesIdx = xTextFrames
- self.assertEqual(nTextFrames, xTextFrames.getCount()) #Unexpected number of text frames reported
+ self.assertEqual(nTextFrames, xTextFrames.getCount()) # Unexpected number of text frames reported
for nCurrentFrameIdx in range(xTextFramesIdx.getCount()):
xTextFramesIdx.getByIndex(nCurrentFrameIdx)
@@ -122,4 +123,3 @@ class CheckFlies(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
-
diff --git a/sw/qa/python/check_index.py b/sw/qa/python/check_index.py
index bdbd8121d128..9c8c01c3963e 100644
--- a/sw/qa/python/check_index.py
+++ b/sw/qa/python/check_index.py
@@ -5,8 +5,9 @@ from org.libreoffice.unotest import UnoInProcess
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
from com.sun.star.util import XRefreshListener
+
class RefreshListener(XRefreshListener, unohelper.Base):
-
+
def __init__(self):
self.m_bDisposed = False
self.m_bRefreshed = False
@@ -16,11 +17,12 @@ class RefreshListener(XRefreshListener, unohelper.Base):
def refreshed(self, event):
self.m_bRefreshed = True
-
+
def assertRefreshed(self):
assert(self.m_bRefreshed)
self.m_bRefreshed = False
-
+
+
class CheckIndex(unittest.TestCase):
@classmethod
@@ -31,8 +33,8 @@ class CheckIndex(unittest.TestCase):
@classmethod
def tearDownClass(cls):
- cls._uno.tearDown()
-
+ cls._uno.tearDown()
+
def test_check_index(self):
xDoc = self.__class__._xDoc
xIndex = xDoc.createInstance("com.sun.star.text.ContentIndex")
@@ -55,7 +57,7 @@ class CheckIndex(unittest.TestCase):
test_string = "a heading"
xCursor.setString(test_string)
xCursor.gotoStartOfParagraph(True)
- xCursor.setPropertyValue("ParaStyleName","Heading 1")
+ xCursor.setPropertyValue("ParaStyleName", "Heading 1")
# hope text is in last paragraph...
xIndex.refresh()
@@ -64,7 +66,7 @@ class CheckIndex(unittest.TestCase):
xCursor.gotoStartOfParagraph(True)
text = xCursor.getString()
# check if we got text with 'test_string'
- assert( text.find(test_string) >= 0 )
+ assert(text.find(test_string) >= 0)
# insert some more heading
xCursor.gotoEnd(False)
@@ -73,7 +75,7 @@ class CheckIndex(unittest.TestCase):
test_string = "yet another heading"
xCursor.setString(test_string)
xCursor.gotoStartOfParagraph(True)
- xCursor.setPropertyValue("ParaStyleName","Heading 1")
+ xCursor.setPropertyValue("ParaStyleName", "Heading 1")
# try again with update
xIndex.update()
@@ -82,13 +84,13 @@ class CheckIndex(unittest.TestCase):
xCursor.gotoStartOfParagraph(True)
text = xCursor.getString()
# check if we got text with 'test_string'
- assert( text.find(test_string) >= 0 )
-
+ assert(text.find(test_string) >= 0)
+
# dispose must call the listener
assert(not listener.m_bDisposed)
xIndex.dispose()
assert(listener.m_bDisposed)
-
+
# close the document
xDoc.dispose()
if __name__ == "__main__":
diff --git a/sw/qa/python/check_indexed_property_values.py b/sw/qa/python/check_indexed_property_values.py
index b14635958ab8..8cbe6160aeee 100644
--- a/sw/qa/python/check_indexed_property_values.py
+++ b/sw/qa/python/check_indexed_property_values.py
@@ -1,12 +1,12 @@
'''
This file is part of the LibreOffice project.
-
+
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
+
This file incorporates work covered by the following license notice:
-
+
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright
@@ -26,6 +26,7 @@ from org.libreoffice.unotest import OfficeConnection
from com.sun.star.lang import IllegalArgumentException
from com.sun.star.lang import IndexOutOfBoundsException
+
class CheckIndexedPropertyValues(unittest.TestCase):
@classmethod
@@ -39,11 +40,10 @@ class CheckIndexedPropertyValues(unittest.TestCase):
def tearDownClass(cls):
cls._uno.tearDown()
-
def test_checkIndexedPropertyValues(self):
-
xServiceManager = self.xContext.ServiceManager
- xCont = xServiceManager.createInstanceWithContext('com.sun.star.document.IndexedPropertyValues', self.xContext)
+ xCont = xServiceManager.createInstanceWithContext('com.sun.star.document.IndexedPropertyValues',
+ self.xContext)
p1 = PropertyValue(Name="Jupp", Value="GoodGuy")
prop1 = uno.Any("[]com.sun.star.beans.PropertyValue", (p1,))
@@ -68,10 +68,10 @@ class CheckIndexedPropertyValues(unittest.TestCase):
self.assertEqual(p2.Value, ret[0].Value)
xCont.removeByIndex(0)
- self.assertTrue(not(xCont.hasElements()) and xCont.getCount()==0, "Could not remove PropertyValue")
+ self.assertTrue(not(xCont.hasElements()) and xCont.getCount() == 0, "Could not remove PropertyValue")
uno.invoke(xCont, "insertByIndex", (0, prop1))
uno.invoke(xCont, "insertByIndex", (1, prop2))
- self.assertTrue(xCont.hasElements() and xCont.getCount()==2, "Did not insert PropertyValue")
+ self.assertTrue(xCont.hasElements() and xCont.getCount() == 2, "Did not insert PropertyValue")
uno.invoke(xCont, "insertByIndex", (1, prop2))
uno.invoke(xCont, "insertByIndex", (1, prop3))
diff --git a/sw/qa/python/check_named_property_values.py b/sw/qa/python/check_named_property_values.py
index 2859699744f6..dd06adc60313 100644
--- a/sw/qa/python/check_named_property_values.py
+++ b/sw/qa/python/check_named_property_values.py
@@ -42,11 +42,11 @@ class CheckNamedPropertyValues(unittest.TestCase):
def tearDownClass(cls):
cls._uno.tearDown()
-
def test_checkNamedPropertyValues(self):
xServiceManager = self.xContext.ServiceManager
- xCont = xServiceManager.createInstanceWithContext('com.sun.star.document.NamedPropertyValues', self.xContext)
+ xCont = xServiceManager.createInstanceWithContext('com.sun.star.document.NamedPropertyValues',
+ self.xContext)
p1 = PropertyValue(Name="Jupp", Value="GoodGuy")
prop1 = uno.Any("[]com.sun.star.beans.PropertyValue", (p1,))
@@ -82,9 +82,7 @@ class CheckNamedPropertyValues(unittest.TestCase):
uno.invoke(xCont, "insertByName", ("prop2", prop1))
with self.assertRaises(IllegalArgumentException):
- uno.invoke(xCont, "insertByName",("prop3", "Example String"))
+ uno.invoke(xCont, "insertByName", ("prop3", "Example String"))
with self.assertRaises(NoSuchElementException):
xCont.removeByName("prop3")
-
-
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index cdc741ee6a92..2e34f32cea6b 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -33,7 +33,7 @@ class CheckStyle(unittest.TestCase):
self.assertEqual(len(xStyleFamilies.SupportedServiceNames), 1)
for servicename in xStyleFamilies.SupportedServiceNames:
- self.assertIn(servicename, ["com.sun.star.style.StyleFamilies"] )
+ self.assertIn(servicename, ["com.sun.star.style.StyleFamilies"])
self.assertTrue(xStyleFamilies.supportsService(servicename))
self.assertFalse(xStyleFamilies.supportsService("foobarbaz"))
self.assertTrue(xStyleFamilies.hasElements())
@@ -41,7 +41,8 @@ class CheckStyle(unittest.TestCase):
self.assertEqual(len(xStyleFamilies.ElementNames), 5)
for sFamilyname in xStyleFamilies.ElementNames:
- self.assertIn(sFamilyname, ["CharacterStyles", "ParagraphStyles", "PageStyles", "FrameStyles", "NumberingStyles"])
+ self.assertIn(sFamilyname,
+ ["CharacterStyles", "ParagraphStyles", "PageStyles", "FrameStyles", "NumberingStyles"])
with self.assertRaises(NoSuchElementException):
xStyleFamilies.getByName("foobarbaz")
@@ -52,7 +53,7 @@ class CheckStyle(unittest.TestCase):
self.assertEqual(len(xFamily.SupportedServiceNames), 1)
for sServicename in xFamily.SupportedServiceNames:
- self.assertIn(sServicename, ["com.sun.star.style.StyleFamily"] )
+ self.assertIn(sServicename, ["com.sun.star.style.StyleFamily"])
self.assertTrue(xFamily.supportsService(sServicename))
self.assertFalse(xFamily.supportsService("foobarbaz"))
self.assertTrue(xFamily.hasElements())
@@ -68,7 +69,7 @@ class CheckStyle(unittest.TestCase):
self.assertTrue(xFamily.hasByName(sStylename))
self.assertEqual(xFamily[sStylename].ImplementationName, "SwXStyle")
self.assertFalse(xFamily[sStylename].isUserDefined())
-
+
vExpectedNames.sort()
vNames = list(xFamily.ElementNames)
vNames.sort()
diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index 262c4bd8cb9b..d718fb893d5e 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -5,23 +5,26 @@ from com.sun.star.beans import PropertyValue
from com.sun.star.uno import RuntimeException
from com.sun.star.table import BorderLine
from com.sun.star.table import BorderLine2
-from com.sun.star.table.BorderLineStyle import (DOUBLE, SOLID, EMBOSSED,\
- THICKTHIN_LARGEGAP, DASHED, DOTTED)
+from com.sun.star.table.BorderLineStyle import (DOUBLE, SOLID, EMBOSSED,
+ THICKTHIN_LARGEGAP, DASHED, DOTTED)
from com.sun.star.util import XNumberFormats
from com.sun.star.lang import Locale
+
class CheckTable(unittest.TestCase):
def _fill_table(self, xTable):
+
for x in range(3):
for y in range(3):
xTable.getCellByPosition(x, y).String = 'Cell %d %d' % (x, y)
+
def _check_table(self, xTable):
+
for x in range(3):
for y in range(3):
self.assertEqual('Cell %d %d' % (x, y), xTable.getCellByPosition(x, y).String)
-
@classmethod
def setUpClass(cls):
cls._uno = UnoInProcess()
@@ -69,8 +72,8 @@ class CheckTable(unittest.TestCase):
self.__test_borderDistance(border)
# set border
- border.TopLine = BorderLine(0, 11, 19, 19)
- border.BottomLine = BorderLine(0xFF, 00, 11, 00)
+ border.TopLine = BorderLine(0, 11, 19, 19)
+ border.BottomLine = BorderLine(0xFF, 00, 11, 00)
border.HorizontalLine = BorderLine(0xFF00, 00, 90, 00)
xTable.setPropertyValue("TableBorder", border)
# read set border
@@ -92,7 +95,6 @@ class CheckTable(unittest.TestCase):
self.__test_borderAsserts(border.RightLine, border.IsRightLineValid)
-
self.assertTrue(border.IsHorizontalLineValid)
self.assertEqual(0, border.HorizontalLine.InnerLineWidth)
self.assertEqual(90, border.HorizontalLine.OuterLineWidth)
@@ -101,14 +103,13 @@ class CheckTable(unittest.TestCase):
self.__test_borderAsserts(border.VerticalLine, border.IsVerticalLineValid)
-
self.__test_borderDistance(border)
border2 = xTable.getPropertyValue("TableBorder2")
self.assertTrue(border2.IsTopLineValid)
self.assertEqual(11, border2.TopLine.InnerLineWidth)
self.assertEqual(19, border2.TopLine.OuterLineWidth)
- self.assertEqual(19, border2.TopLine.LineDistance)
+ self.assertEqual(19, border2.TopLine.LineDistance)
self.assertEqual(0, border2.TopLine.Color)
self.assertEqual(DOUBLE, border2.TopLine.LineStyle)
self.assertEqual(49, border2.TopLine.LineWidth)
@@ -137,9 +138,9 @@ class CheckTable(unittest.TestCase):
self.__test_borderDistance(border2)
# set border2
- border2.RightLine = BorderLine2(0, 0, 0, 0, THICKTHIN_LARGEGAP, 120)
- border2.LeftLine = BorderLine2(0, 0, 0, 0, EMBOSSED, 90)
- border2.VerticalLine = BorderLine2(0xFF, 0, 90, 0, DOTTED, 0)
+ border2.RightLine = BorderLine2(0, 0, 0, 0, THICKTHIN_LARGEGAP, 120)
+ border2.LeftLine = BorderLine2(0, 0, 0, 0, EMBOSSED, 90)
+ border2.VerticalLine = BorderLine2(0xFF, 0, 90, 0, DOTTED, 0)
border2.HorizontalLine = BorderLine2(0xFF00, 0, 0, 0, DASHED, 11)
xTable.setPropertyValue("TableBorder2", border2)
# read set border2
@@ -237,8 +238,8 @@ class CheckTable(unittest.TestCase):
xTable.ChartRowAsLabel = False
self.assertEqual(0, len(xTable.RowDescriptions))
self.assertEqual(0, len(xTable.ColumnDescriptions))
- self.RowDescriptions = ('foo', 'bar', 'baz') # no labels, thus noop
- self.ColumnDescriptions = ('foo', 'bar', 'baz') # no labels, thus noop
+ self.RowDescriptions = ('foo', 'bar', 'baz') # no labels, thus noop
+ self.ColumnDescriptions = ('foo', 'bar', 'baz') # no labels, thus noop
self._check_table(xTable)
# now check with labels
xTable.ChartColumnAsLabel = True
@@ -250,21 +251,21 @@ class CheckTable(unittest.TestCase):
self.assertEqual('Cell 1 0', xTable.ColumnDescriptions[0])
self.assertEqual('Cell 2 0', xTable.ColumnDescriptions[1])
with self.assertRaises(Exception):
- xTable.RowDescriptions = ('foo',) # too short
+ xTable.RowDescriptions = ('foo',) # too short
with self.assertRaises(Exception):
- xTable.ColumnDescriptions = ('foo',) # too short
+ xTable.ColumnDescriptions = ('foo',) # too short
self._check_table(xTable)
xTable.RowDescriptions = ('fooRow', 'bazRow')
xTable.ColumnDescriptions = ('fooColumn', 'bazColumn')
- self.assertEqual('fooRow', xTable.getCellByPosition(0,1).String)
- self.assertEqual('bazRow', xTable.getCellByPosition(0,2).String)
- self.assertEqual('fooColumn', xTable.getCellByPosition(1,0).String)
- self.assertEqual('bazColumn', xTable.getCellByPosition(2,0).String)
- xTable.getCellByPosition(0,1).String = 'Cell 0 1' # reset changes values ...
- xTable.getCellByPosition(0,2).String = 'Cell 0 2'
- xTable.getCellByPosition(1,0).String = 'Cell 1 0'
- xTable.getCellByPosition(2,0).String = 'Cell 2 0'
- self._check_table(xTable) # ... to ensure the rest was untouched
+ self.assertEqual('fooRow', xTable.getCellByPosition(0, 1).String)
+ self.assertEqual('bazRow', xTable.getCellByPosition(0, 2).String)
+ self.assertEqual('fooColumn', xTable.getCellByPosition(1, 0).String)
+ self.assertEqual('bazColumn', xTable.getCellByPosition(2, 0).String)
+ xTable.getCellByPosition(0, 1).String = 'Cell 0 1' # reset changes values ...
+ xTable.getCellByPosition(0, 2).String = 'Cell 0 2'
+ xTable.getCellByPosition(1, 0).String = 'Cell 1 0'
+ xTable.getCellByPosition(2, 0).String = 'Cell 2 0'
+ self._check_table(xTable) # ... to ensure the rest was untouched
# check disconnected table excepts, but doesnt crash
xTable2 = xDoc.createInstance("com.sun.star.text.TextTable")
xTable2.initialize(3, 3)
@@ -284,28 +285,28 @@ class CheckTable(unittest.TestCase):
xTable.ChartColumnAsLabel = False
xTable.ChartRowAsLabel = False
# roundtrip
- xTable.Data = ((1,2,3), (4,5,6), (7,8,9), (10,11,12))
- self.assertEqual( xTable.Data, ((1,2,3), (4,5,6), (7,8,9), (10,11,12)))
+ xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
+ self.assertEqual(xTable.Data, ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12)))
# missing row
with self.assertRaises(Exception):
- xTable.Data = ((1,2,3), (4,5,6), (7,8,9))
+ xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9))
# missing column
with self.assertRaises(Exception):
- xTable.Data = ((1,2), (4,5), (7,8), (10,11))
+ xTable.Data = ((1, 2), (4, 5), (7, 8), (10, 11))
# with labels
xTable.ChartColumnAsLabel = True
xTable.ChartRowAsLabel = True
- self.assertEqual( xTable.Data, ((5,6), (8,9), (11,12)))
- xTable.Data = ((55,66), (88,99), (1111,1212))
+ self.assertEqual(xTable.Data, ((5, 6), (8, 9), (11, 12)))
+ xTable.Data = ((55, 66), (88, 99), (1111, 1212))
xTable.ChartColumnAsLabel = True
xTable.ChartRowAsLabel = False
- self.assertEqual( xTable.Data, ((2,3), (55,66), (88,99), (1111,1212)))
+ self.assertEqual(xTable.Data, ((2, 3), (55, 66), (88, 99), (1111, 1212)))
xTable.ChartColumnAsLabel = False
xTable.ChartRowAsLabel = True
- self.assertEqual( xTable.Data, ((4,55,66), (7,88,99), (10,1111,1212)))
+ self.assertEqual(xTable.Data, ((4, 55, 66), (7, 88, 99), (10, 1111, 1212)))
xTable.ChartColumnAsLabel = False
xTable.ChartRowAsLabel = False
- self.assertEqual( xTable.Data, ((1,2,3), (4,55,66), (7,88,99), (10,1111,1212)))
+ self.assertEqual(xTable.Data, ((1, 2, 3), (4, 55, 66), (7, 88, 99), (10, 1111, 1212)))
xDoc.dispose()
def test_remove_colrow(self):
@@ -316,7 +317,7 @@ class CheckTable(unittest.TestCase):
xDoc.Text.insertTextContent(xCursor, xTable, False)
xTable.ChartColumnAsLabel = False
xTable.ChartRowAsLabel = False
- xTable.Data = ((1,2,3), (4,5,6), (7,8,9), (10,11,12))
+ xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
xRows = xTable.Rows
self.assertEqual(xRows.ImplementationName, 'SwXTableRows')
self.assertTrue(xRows.supportsService('com.sun.star.text.TableRows'))
@@ -324,7 +325,7 @@ class CheckTable(unittest.TestCase):
self.assertIn('com.sun.star.text.TableRows', xRows.SupportedServiceNames)
self.assertNotIn('foo', xRows.SupportedServiceNames)
xRows.removeByIndex(1, 2)
- self.assertEqual( xTable.Data, ((1,2,3), (10,11,12)))
+ self.assertEqual(xTable.Data, ((1, 2, 3), (10, 11, 12)))
xCols = xTable.Columns
self.assertEqual(xCols.ImplementationName, 'SwXTableColumns')
self.assertTrue(xCols.supportsService('com.sun.star.text.TableColumns'))
@@ -332,7 +333,7 @@ class CheckTable(unittest.TestCase):
self.assertIn('com.sun.star.text.TableColumns', xCols.SupportedServiceNames)
self.assertNotIn('foo', xCols.SupportedServiceNames)
xCols.removeByIndex(1, 1)
- self.assertEqual( xTable.Data, ((1,3), (10,12)))
+ self.assertEqual(xTable.Data, ((1, 3), (10, 12)))
xDoc.dispose()
def test_insert_colrow(self):
@@ -343,14 +344,14 @@ class CheckTable(unittest.TestCase):
xDoc.Text.insertTextContent(xCursor, xTable, False)
xTable.ChartColumnAsLabel = False
xTable.ChartRowAsLabel = False
- xTable.Data = ((1,2,3), (4,5,6), (7,8,9), (10,11,12))
+ xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
xRows = xTable.Rows
xRows.insertByIndex(1, 2)
nan = float('nan')
- self.assertEqual(xTable.Data[0], (1,2,3))
- self.assertEqual(xTable.Data[3], (4,5,6))
- self.assertEqual(xTable.Data[4], (7,8,9))
- self.assertEqual(xTable.Data[5], (10,11,12))
+ self.assertEqual(xTable.Data[0], (1, 2, 3))
+ self.assertEqual(xTable.Data[3], (4, 5, 6))
+ self.assertEqual(xTable.Data[4], (7, 8, 9))
+ self.assertEqual(xTable.Data[5], (10, 11, 12))
for x in range(3):
self.assertTrue(math.isnan(xTable.Data[1][x]))
self.assertTrue(math.isnan(xTable.Data[2][x]))
@@ -385,7 +386,7 @@ class CheckTable(unittest.TestCase):
xDoc.Text.insertTextContent(xCursor, xTable, False)
xTable.ChartColumnAsLabel = False
xTable.ChartRowAsLabel = False
- xTable.Data = ((1,2,3), (4,5,6), (7,8,9), (10,11,12))
+ xTable.Data = ((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12))
self.assertTrue(xTable.Name == 'Table1')
self.assertIn('com.sun.star.text.GenericTextDocument', xDoc.SupportedServiceNames)
xChartdataprovider = xDoc.createInstance('com.sun.star.chart2.data.DataProvider')
@@ -398,7 +399,7 @@ class CheckTable(unittest.TestCase):
pv.Value = 'Table1.A1:C2'
xDataSource = xChartdataprovider.createDataSource((pv,))
self.assertEqual(len(xDataSource.DataSequences), 3)
- expectedValues = ((1,4), (2,5), (3,6))
+ expectedValues = ((1, 4), (2, 5), (3, 6))
expectedCellrange = ('A1:A2', 'B1:B2', 'C1:C2')
for col in range(3):
xSeq = xDataSource.DataSequences[col].Values
@@ -411,7 +412,7 @@ class CheckTable(unittest.TestCase):
self.assertEqual(xSeq.NumericalData, expectedValues[col])
self.assertEqual(
[int(txtval) for txtval in xSeq.TextualData],
- [val for val in expectedValues[col]])
+ [val for val in expectedValues[col]])
xDoc.dispose()
def test_tdf32082(self):
@@ -422,7 +423,7 @@ class CheckTable(unittest.TestCase):
xDispatcher = xServiceManager.createInstanceWithContext(
'com.sun.star.frame.DispatchHelper', xContext)
xTable = xDoc.createInstance("com.sun.star.text.TextTable")
- xTable.initialize(1,1)
+ xTable.initialize(1, 1)
xCursor = xDoc.Text.createTextCursor()
xDoc.Text.insertTextContent(xCursor, xTable, False)
# Setup numberformat for the cell
@@ -433,22 +434,22 @@ class CheckTable(unittest.TestCase):
if key == -1:
key = xNumberFormats.addNew(formatString, xLocale)
# Apply the format on the first cell
- xTable.getCellByPosition(0,0).NumberFormat = key
+ xTable.getCellByPosition(0, 0).NumberFormat = key
xDispatcher.executeDispatch(xDocFrame, '.uno:GoToStartOfDoc', '', 0, ())
xDispatcher.executeDispatch(xDocFrame, '.uno:InsertText', '', 0,
- (PropertyValue('Text', 0, '3', 0),))
+ (PropertyValue('Text', 0, '3', 0),))
xDispatcher.executeDispatch(xDocFrame, '.uno:JumpToNextCell', '', 0, ())
# Check that the formatting we set up is not destroyed
- self.assertEqual(xTable.getCellByPosition(0,0).getString(), '3.00 €')
- self.assertEqual(xTable.getCellByPosition(0,0).getValue(), 3)
+ self.assertEqual(xTable.getCellByPosition(0, 0).getString(), '3.00 €')
+ self.assertEqual(xTable.getCellByPosition(0, 0).getValue(), 3)
# Verify that it works with number recognition turned on as well
xDispatcher.executeDispatch(xDocFrame, '.uno:TableNumberRecognition', '', 0,
- (PropertyValue('TableNumberRecognition', 0, True, 0),))
+ (PropertyValue('TableNumberRecognition', 0, True, 0),))
xDispatcher.executeDispatch(xDocFrame, '.uno:InsertText', '', 0,
- (PropertyValue('Text', 0, '4', 0),))
+ (PropertyValue('Text', 0, '4', 0),))
xDispatcher.executeDispatch(xDocFrame, '.uno:JumpToNextCell', '', 0, ())
- self.assertEqual(xTable.getCellByPosition(0,1).getString(), '4.00 €')
- self.assertEqual(xTable.getCellByPosition(0,1).getValue(), 4)
+ self.assertEqual(xTable.getCellByPosition(0, 1).getString(), '4.00 €')
+ self.assertEqual(xTable.getCellByPosition(0, 1).getValue(), 4)
xDoc.dispose()
def test_numberRecognition(self):
@@ -459,26 +460,26 @@ class CheckTable(unittest.TestCase):
xDispatcher = xServiceManager.createInstanceWithContext(
'com.sun.star.frame.DispatchHelper', xContext)
xTable = xDoc.createInstance('com.sun.star.text.TextTable')
- xTable.initialize(2,1)
+ xTable.initialize(2, 1)
xCursor = xDoc.Text.createTextCursor()
xDoc.Text.insertTextContent(xCursor, xTable, False)
xDispatcher.executeDispatch(xDocFrame, '.uno:GoToStartOfDoc', '', 0, ())
xDispatcher.executeDispatch(xDocFrame, '.uno:InsertText', '', 0,
- (PropertyValue('Text', 0, '15-10-30', 0),))
+ (PropertyValue('Text', 0, '15-10-30', 0),))
xDispatcher.executeDispatch(xDocFrame, '.uno:JumpToNextCell', '', 0, ())
# Without number recognition 15-10-30 should not be interpretated as a date
- self.assertEqual(xTable.getCellByPosition(0,0).getString(), '15-10-30')
- self.assertEqual(xTable.getCellByPosition(0,0).getValue(), 0)
+ self.assertEqual(xTable.getCellByPosition(0, 0).getString(), '15-10-30')
+ self.assertEqual(xTable.getCellByPosition(0, 0).getValue(), 0)
# Activate number recognition
xDispatcher.executeDispatch(xDocFrame, '.uno:TableNumberRecognition', '', 0,
- (PropertyValue('TableNumberRecognition', 0, True, 0),))
+ (PropertyValue('TableNumberRecognition', 0, True, 0),))
xDispatcher.executeDispatch(xDocFrame, '.uno:InsertText', '', 0,
- (PropertyValue('Text', 0, '15-10-30', 0),))
+ (PropertyValue('Text', 0, '15-10-30', 0),))
xDispatcher.executeDispatch(xDocFrame, '.uno:JumpToNextCell', '', 0, ())
# With number recognition it should now be a date, confirm by checking
# the string and value of the cell.
- self.assertEqual(xTable.getCellByPosition(0,1).getString(), '2015-10-30')
- self.assertEqual(xTable.getCellByPosition(0,1).getValue(), 42307.0)
+ self.assertEqual(xTable.getCellByPosition(0, 1).getString(), '2015-10-30')
+ self.assertEqual(xTable.getCellByPosition(0, 1).getValue(), 42307.0)
xDoc.dispose()
if __name__ == '__main__':
diff --git a/sw/qa/python/get_expression.py b/sw/qa/python/get_expression.py
index 3db661547878..0b2dfe87f07e 100644
--- a/sw/qa/python/get_expression.py
+++ b/sw/qa/python/get_expression.py
@@ -1,6 +1,7 @@
import unittest
from org.libreoffice.unotest import UnoInProcess
+
class TestGetExpression(unittest.TestCase):
@classmethod
@@ -38,4 +39,3 @@ class TestGetExpression(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
-
diff --git a/sw/qa/python/load_save_test.py b/sw/qa/python/load_save_test.py
index 5aa0f3ba7cbf..41175fb9440b 100644
--- a/sw/qa/python/load_save_test.py
+++ b/sw/qa/python/load_save_test.py
@@ -76,13 +76,17 @@ class LoadSaveTest(unittest.TestCase):
sourceFile = "file:///" + filepath + "/" + quote(self.fileName)
else:
sourceFile = "file://" + quote(filepath) + "/" + quote(self.fileName)
- self.xDoc = desktop.loadComponentFromURL(sourceFile ,"_blank", 0 , loadProps)
+ self.xDoc = desktop.loadComponentFromURL(sourceFile, "_blank", 0, loadProps)
assert(self.xDoc)
if os.name == "nt":
targetFile = "file:///" + self.m_TargetDir + quote(self.m_SourceDir) + "/" + quote(self.fileName)
else:
- targetFile = "file://" + quote(self.m_TargetDir) + quote(self.m_SourceDir) + "/" + quote(self.fileName)
+ targetFile = "file://" +
+ quote(self.m_TargetDir) +
+ quote(self.m_SourceDir) +
+ "/" +
+ quote(self.fileName)
p1 = PropertyValue()
PropValue = uno.Any("[]com.sun.star.beans.PropertyValue", (p1,))
@@ -91,7 +95,6 @@ class LoadSaveTest(unittest.TestCase):
except Exception:
raise
-
def getDirAndFile(self, dir):
root2 = os.mkdir(dir)
@@ -114,17 +117,17 @@ class LoadSaveTest(unittest.TestCase):
self.getDirAndFileNames(subfileName)
if os.path.isfile(fdName):
- self.files.append(fdName.split('/')[-1]);
+ self.files.append(fdName.split('/')[-1])
def makeDirs(self, target):
if not os.path.exists(target):
os.mkdir(target)
- self.assertTrue( os.path.exists(target))
+ self.assertTrue(os.path.exists(target))
for dir in self.dirs:
if not os.path.exists(target + dir):
f = os.mkdir(target + dir)
- self.assertTrue( os.path.exists(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")
+ filepath = os.path.abspath(target + dir + "/" + self.m_SourceDir + ".odt")
diff --git a/sw/qa/python/set_expression.py b/sw/qa/python/set_expression.py
index db32799fb47c..8e420020b678 100644
--- a/sw/qa/python/set_expression.py
+++ b/sw/qa/python/set_expression.py
@@ -1,7 +1,8 @@
import unittest
from org.libreoffice.unotest import UnoInProcess
-#@unittest.skip("that seems to work")
+
+# @unittest.skip("that seems to work")
class TestSetExpresion(unittest.TestCase):
@classmethod
@@ -35,4 +36,3 @@ class TestSetExpresion(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
-
diff --git a/sw/qa/python/var_fields.py b/sw/qa/python/var_fields.py
index 28688858c52a..de8f102a62c1 100644
--- a/sw/qa/python/var_fields.py
+++ b/sw/qa/python/var_fields.py
@@ -3,6 +3,7 @@ import os
from org.libreoffice.unotest import UnoInProcess
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
+
class TestVarFields(unittest.TestCase):
@classmethod
@@ -29,12 +30,11 @@ class TestVarFields(unittest.TestCase):
xField = xDoc.createInstance("com.sun.star.text.textfield.SetExpression")
# 1. fill it with properties
self.__class__._uno.setProperties(xField,
- {"Content": "0",
- "IsVisible": True,
- "Hint": "trying to reproduce fdo#55814",
- "SubType": 0, # VAR
- "Value": 0.0
- })
+ {"Content": "0",
+ "IsVisible": True,
+ "Hint": "trying to reproduce fdo#55814",
+ "SubType": 0, # VAR
+ "Value": 0.0})
# 2. create master field
xMaster = xDoc.createInstance("com.sun.star.text.fieldmaster.SetExpression")
# 3. set name of the master field to "foo"
@@ -47,7 +47,7 @@ class TestVarFields(unittest.TestCase):
xBodyText.insertTextContent(xCursor, xField, False)
# 7. retrieve paragraph cursor
xParagraphCursor = xCursor
- xParagraphCursor.gotoEndOfParagraph(False) # not selectd
+ xParagraphCursor.gotoEndOfParagraph(False) # not selectd
# 8. enter new line
xBodyText.insertControlCharacter(xCursor, PARAGRAPH_BREAK, False)
# 9. create new text section
@@ -67,9 +67,9 @@ class TestVarFields(unittest.TestCase):
# 12. insert section
xBodyText.insertTextContent(xCursor, xTextSection, True)
# 12.1 insert new paragraph. Note: that's here the difference
- xParagraphCursor.gotoEndOfParagraph(False) # not select
+ xParagraphCursor.gotoEndOfParagraph(False) # not select
# TODO: how to leave the section now?
- xBodyText.insertControlCharacter(xCursor, PARAGRAPH_BREAK, False )
+ xBodyText.insertControlCharacter(xCursor, PARAGRAPH_BREAK, False)
xBodyText.insertString(xCursor, "new paragraph", False)
# 13. Access fields to refresh the document
xTextFields = xDoc.getTextFields()
@@ -103,7 +103,7 @@ class TestVarFields(unittest.TestCase):
readContent = xSection.getPropertyValue("Condition")
# 21. check
# expected:
- #self.assertEqual("foo EQ 1", readContent)
+ # self.assertEqual("foo EQ 1", readContent)
# reality:
self.assertEqual("0", readContent)