testtools, uitest, unotest: fix issues found by Ruff linter

Change-Id: I4a848b0f1f114d1262b5242786e088eb50a33cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171145
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Ilmari Lauhakangas
2024-07-28 20:07:43 +03:00
parent ac41bc3c90
commit d7628892b0
6 changed files with 38 additions and 38 deletions

View File

@@ -46,21 +46,21 @@ def equalsEps( a,b,eps ):
def assign( rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\ def assign( rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\
nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ): nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ):
rData.Bool = bBool; rData.Bool = bBool
rData.Char = cChar; rData.Char = cChar
rData.Byte = nByte; rData.Byte = nByte
rData.Short = nShort; rData.Short = nShort
rData.UShort = nUShort; rData.UShort = nUShort
rData.Long = nLong; rData.Long = nLong
rData.ULong = nULong; rData.ULong = nULong
rData.Hyper = nHyper; rData.Hyper = nHyper
rData.UHyper = nUHyper; rData.UHyper = nUHyper
rData.Float = fFloat; rData.Float = fFloat
rData.Double = fDouble; rData.Double = fDouble
rData.Enum = eEnum; rData.Enum = eEnum
rData.String = rStr; rData.String = rStr
rData.Interface = xTest; rData.Interface = xTest
rData.Any = rAny; rData.Any = rAny
class PythonTransporter: class PythonTransporter:

View File

@@ -32,21 +32,21 @@ g_attribs = "RuntimeException", "Bool", "Char", "Byte", "Short", "UShort", \
def assign( rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\ def assign( rData, bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper,\
nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ): nUHyper, fFloat, fDouble, eEnum, rStr, xTest, rAny ):
rData.Bool = bBool; rData.Bool = bBool
rData.Char = cChar; rData.Char = cChar
rData.Byte = nByte; rData.Byte = nByte
rData.Short = nShort; rData.Short = nShort
rData.UShort = nUShort; rData.UShort = nUShort
rData.Long = nLong; rData.Long = nLong
rData.ULong = nULong; rData.ULong = nULong
rData.Hyper = nHyper; rData.Hyper = nHyper
rData.UHyper = nUHyper; rData.UHyper = nUHyper
rData.Float = fFloat; rData.Float = fFloat
rData.Double = fDouble; rData.Double = fDouble
rData.Enum = eEnum; rData.Enum = eEnum
rData.String = rStr; rData.String = rStr
rData.Interface = xTest; rData.Interface = xTest
rData.Any = rAny; rData.Any = rAny
class MyRecursiveCall( XRecursiveCall, unohelper.Base ): class MyRecursiveCall( XRecursiveCall, unohelper.Base ):
def callRecursivly( xCall, nToCall ): def callRecursivly( xCall, nToCall ):

View File

@@ -116,7 +116,7 @@ if __name__ == '__main__':
if "-h" in opts or "--help" in opts: if "-h" in opts or "--help" in opts:
usage() usage()
sys.exit() sys.exit()
elif not "--soffice" in opts: elif "--soffice" not in opts:
usage() usage()
sys.exit(1) sys.exit(1)
elif "--dir" in opts: elif "--dir" in opts:

View File

@@ -46,7 +46,7 @@ class ul_Compiler:
parent_hierarchy_count = 0 parent_hierarchy_count = 0
last_parent = [] last_parent = []
flag_for_QuerySaveDialog = False flag_for_QuerySaveDialog = False
math_element_selector_initializer= False; math_element_selector_initializer= False
def __init__(self, input_address, output_address): def __init__(self, input_address, output_address):
self.ui_dsl_mm = metamodel_from_file("ui_logger_dsl_grammar.tx") self.ui_dsl_mm = metamodel_from_file("ui_logger_dsl_grammar.tx")
@@ -961,7 +961,7 @@ class ul_Compiler:
def handle_math_element_selector(self, math_element_selector): def handle_math_element_selector(self, math_element_selector):
if( self.math_element_selector_initializer == False ): if not self.math_element_selector_initializer:
# This part is for initializing the element selector in the Math application # This part is for initializing the element selector in the Math application
self.math_element_selector_initializer = True self.math_element_selector_initializer = True
line = ( line = (

View File

@@ -16,14 +16,14 @@ def testAppDialog(UITestCase, app, dialog):
with UITestCase.ui_test.create_doc_in_start_center(app): with UITestCase.ui_test.create_doc_in_start_center(app):
with UITestCase.ui_test.execute_dialog_through_command( with UITestCase.ui_test.execute_dialog_through_command(
dialog['command'], close_button=dialog['closeButton']) as xDialog: dialog['command'], close_button=dialog['closeButton']) as xDialog:
if 'skipTestOK' in dialog and dialog['skipTestOK'] == True: if 'skipTestOK' in dialog and dialog['skipTestOK']:
xOKBtn = None xOKBtn = None
else: else:
try: try:
xOKBtn = xDialog.getChild("ok") xOKBtn = xDialog.getChild("ok")
if (get_state_as_dict(xOKBtn)["Enabled"] != "true"): if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
xOKBtn = None xOKBtn = None
except: except Exception:
xOKBtn = None xOKBtn = None
if (xOKBtn is not None): if (xOKBtn is not None):
@@ -47,14 +47,14 @@ def testChartDialog(UITestCase, dialog):
xObj, "COMMAND", xObj, "COMMAND",
mkPropertyValues({"COMMAND": dialog['command']}), mkPropertyValues({"COMMAND": dialog['command']}),
close_button=dialog['closeButton']) as xDialog: close_button=dialog['closeButton']) as xDialog:
if 'skipTestOK' in dialog and dialog['skipTestOK'] == True: if 'skipTestOK' in dialog and dialog['skipTestOK']:
xOKBtn = None xOKBtn = None
else: else:
try: try:
xOKBtn = xDialog.getChild("ok") xOKBtn = xDialog.getChild("ok")
if (get_state_as_dict(xOKBtn)["Enabled"] != "true"): if (get_state_as_dict(xOKBtn)["Enabled"] != "true"):
xOKBtn = None xOKBtn = None
except: except Exception:
xOKBtn = None xOKBtn = None
if (xOKBtn is not None): if (xOKBtn is not None):

View File

@@ -265,7 +265,7 @@ def retryInvoke(connection, test):
connection.postTest() connection.postTest()
except KeyboardInterrupt: except KeyboardInterrupt:
raise # Ctrl+C should work raise # Ctrl+C should work
except: except Exception:
print("retryInvoke: caught exception") print("retryInvoke: caught exception")
raise Exception("FAILED retryInvoke") raise Exception("FAILED retryInvoke")