diff options
author | Chenxiong Qi <qcxhome@gmail.com> | 2023-12-17 22:14:09 +0800 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2023-12-27 13:48:47 +0100 |
commit | 8b6e0dd9e47c20a79fd194f6d530d1c868911bda (patch) | |
tree | 9ebad0a155cf126fe6fde2b892bb164aaf914000 /sw | |
parent | 7ad6ae594fd92b736b4217268eea47c71c04c34a (diff) |
tdf#158803 Fix issues detected by pyflakes
Change-Id: Iaa329dff61db894e7d5fecd840e785a53a48b26f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160889
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/python/check_xtextrangecompare.py | 2 | ||||
-rw-r--r-- | sw/qa/python/text_portion_enumeration_test.py | 31 | ||||
-rw-r--r-- | sw/qa/uitest/librelogo/run.py | 1 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf154521.py | 4 | ||||
-rw-r--r-- | sw/qa/uitest/table/splitTable.py | 2 | ||||
-rw-r--r-- | sw/qa/uitest/ui/frmdlg/frmdlg.py | 2 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf132714.py | 4 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf156783.py | 2 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf156784.py | 2 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf156900.py | 2 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests8/tdf156243.py | 2 |
11 files changed, 25 insertions, 29 deletions
diff --git a/sw/qa/python/check_xtextrangecompare.py b/sw/qa/python/check_xtextrangecompare.py index 181e97ff6b2e..44eb691f4518 100644 --- a/sw/qa/python/check_xtextrangecompare.py +++ b/sw/qa/python/check_xtextrangecompare.py @@ -80,7 +80,7 @@ class XTextRangeCompare(unittest.TestCase): xDoc.close(True) - def test_compareRegionStarts_DiffSelection(self): + def test_compareRegionStarts_SameSelection(self): xDoc = self._uno.openEmptyWriterDoc() cursor1 = xDoc.Text.createTextCursor() diff --git a/sw/qa/python/text_portion_enumeration_test.py b/sw/qa/python/text_portion_enumeration_test.py index c183aaf41b09..0a064f544cf5 100644 --- a/sw/qa/python/text_portion_enumeration_test.py +++ b/sw/qa/python/text_portion_enumeration_test.py @@ -918,6 +918,10 @@ class FuzzyTester(): print("unexpected node: {}".format(str(node))) +def SoftPageBreakNode(): + raise NotImplementedError("todo") + + class TextPortionEnumerationTest(unittest.TestCase): xMSF = None @@ -963,7 +967,7 @@ class TextPortionEnumerationTest(unittest.TestCase): @unittest.skip("FIXME: insert a soft page break: not done") def test_soft_page_break(self): root = TreeNode() - spbk =SoftPageBreakNode() + spbk = SoftPageBreakNode() text = TextNode("abc") root.appendchild(spbk) root.appendchild(text) @@ -2119,7 +2123,7 @@ class TextPortionEnumerationTest(unittest.TestCase): met2 = MetaNode(self.mkid("id")) try: inserter.insertrange(Range(0, 4, met2)) - fail("testRangeMetaMeta: overlap left allowed") + self.fail("testRangeMetaMeta: overlap left allowed") except IllegalArgumentException: pass root = TreeNode() @@ -2535,7 +2539,7 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta1.setParent(xMeta4) - fail("setParent(): allowed?") + self.fail("setParent(): allowed?") except NoSupportException: pass self.assertIsNone(xMeta1.getParent(), "getParent(): not None") @@ -2592,7 +2596,7 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.createTextCursorByRange(None) - fail("createTextCursorByRange(): None allowed?") + self.fail("createTextCursorByRange(): None allowed?") except RuntimeException: pass @@ -2609,13 +2613,13 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.insertString(None, "foo", False) - fail("insertString(): None allowed?") + self.fail("insertString(): None allowed?") except RuntimeException: pass try: xMeta.insertString(xDocTextCursor, "foo", False) - fail("insertString(): cursor outside allowed?") + self.fail("insertString(): cursor outside allowed?") except RuntimeException: pass @@ -2630,14 +2634,14 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.insertControlCharacter(None, HARD_HYPHEN, False) - fail("insertControlCharacter(): None allowed?") + self.fail("insertControlCharacter(): None allowed?") except IllegalArgumentException: pass xStart = xMeta.getStart() try: xMeta.insertControlCharacter(xDocTextCursor, HARD_HYPHEN, False) - fail("insertControlCharacter(): cursor outside allowed?") + self.fail("insertControlCharacter(): cursor outside allowed?") except IllegalArgumentException: pass @@ -2654,19 +2658,19 @@ class TextPortionEnumerationTest(unittest.TestCase): xMeta.setString("45") try: xMeta.insertTextContent(None, xMeta, False) - fail("insertTextContent(): None range allowed?") + self.fail("insertTextContent(): None range allowed?") except IllegalArgumentException: pass try: xMeta.insertTextContent(xStart, None, False) - fail("insertTextContent(): None content allowed?") + self.fail("insertTextContent(): None content allowed?") except IllegalArgumentException: pass try: xMeta.insertTextContent(xDocTextCursor, xMeta, False) - fail("insertTextContent(): cursor outside allowed?") + self.fail("insertTextContent(): cursor outside allowed?") except IllegalArgumentException: pass @@ -2699,7 +2703,7 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.removeTextContent(None) - fail("removeTextContent(): None content allowed?") + self.fail("removeTextContent(): None content allowed?") except RuntimeException: pass @@ -2775,7 +2779,6 @@ class TextPortionEnumerationTest(unittest.TestCase): ## XTextCursor xMetaCursor = xMeta.createTextCursor() self.assertIsNotNone(xMetaCursor, "createTextCursor(): no cursor") - bSuccess = False xMetaCursor.gotoStart(False) xMetaCursor.gotoEnd(False) bSuccess = xMetaCursor.goLeft(1, False) @@ -2790,7 +2793,7 @@ class TextPortionEnumerationTest(unittest.TestCase): xMetaCursor.gotoRange(xEnd, False) try: xMetaCursor.gotoRange(xDocTextCursor, False) - fail("gotoRange(): succeeded") + self.fail("gotoRange(): succeeded") except RuntimeException: pass diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py index 54e003216015..4c5c13549184 100644 --- a/sw/qa/uitest/librelogo/run.py +++ b/sw/qa/uitest/librelogo/run.py @@ -9,7 +9,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import type_text -from com.sun.star.awt.FontSlant import NONE as __Slant_NONE__ from com.sun.star.awt.FontSlant import ITALIC as __Slant_ITALIC__ from com.sun.star.awt.FontUnderline import NONE as __Underline_NONE__ from com.sun.star.awt.FontUnderline import SINGLE as __Underline_SINGLE__ diff --git a/sw/qa/uitest/navigator/tdf154521.py b/sw/qa/uitest/navigator/tdf154521.py index 048efb0212c2..65a86e7be613 100644 --- a/sw/qa/uitest/navigator/tdf154521.py +++ b/sw/qa/uitest/navigator/tdf154521.py @@ -128,9 +128,9 @@ class tdf154521(UITestCase): xWriterEdit.executeAction("FOCUS", tuple()) - xContentTree = xNavigatorPanel.getChild("contenttree") - # disable flakey UITest +# xContentTree = xNavigatorPanel.getChild("contenttree") + # self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "Bookmark 1") # self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 1") # self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py index 0292c452b187..06af8ee6c89d 100644 --- a/sw/qa/uitest/table/splitTable.py +++ b/sw/qa/uitest/table/splitTable.py @@ -65,7 +65,7 @@ class splitTable(UITestCase): self.assertEqual(writer_doc.TextTables.getCount(), 1) def test_tdf115572_remember_split_table_option(self): - with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")): # Go to second row self.xUITest.executeCommand(".uno:GoDown") self.xUITest.executeCommand(".uno:GoDown") diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py index 36de1876bdd9..f7e91269c299 100644 --- a/sw/qa/uitest/ui/frmdlg/frmdlg.py +++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py @@ -105,7 +105,7 @@ class Test(UITestCase): def test_insert_simple_frame(self): # Given a Writer document: - with self.ui_test.create_doc_in_start_center("writer") as xComponent: + with self.ui_test.create_doc_in_start_center("writer"): # When inserting a simple text frame (not a floating table): with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog: to_char = xDialog.getChild("tochar") diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py index cad8ff24e80d..d2a71587ed77 100644 --- a/sw/qa/uitest/writer_tests7/tdf132714.py +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -14,7 +14,7 @@ from com.sun.star.awt import MouseEvent class tdf132714(UITestCase): def test_tdf132714(self): - with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")): # delete second row (first data row) in the associated text table of the chart self.xUITest.executeCommand(".uno:GoDown") @@ -90,7 +90,7 @@ class tdf132714(UITestCase): xSeriesObj = xChartMain.getChild("CID/Page=") # Without the fix in place, this test would have crashed here - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})): pass diff --git a/sw/qa/uitest/writer_tests7/tdf156783.py b/sw/qa/uitest/writer_tests7/tdf156783.py index 2ccdb7dcf6e1..100d816541e1 100644 --- a/sw/qa/uitest/writer_tests7/tdf156783.py +++ b/sw/qa/uitest/writer_tests7/tdf156783.py @@ -18,8 +18,6 @@ class tdf156783(UITestCase): def test_tdf156783(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # accept all tracked changes self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py b/sw/qa/uitest/writer_tests7/tdf156784.py index 5cac8fc628db..fa522212a8b0 100644 --- a/sw/qa/uitest/writer_tests7/tdf156784.py +++ b/sw/qa/uitest/writer_tests7/tdf156784.py @@ -15,8 +15,6 @@ class tdf156784(UITestCase): def test_tdf156784(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # accept all tracked changes self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") diff --git a/sw/qa/uitest/writer_tests7/tdf156900.py b/sw/qa/uitest/writer_tests7/tdf156900.py index 545be94242f4..945d91aef365 100644 --- a/sw/qa/uitest/writer_tests7/tdf156900.py +++ b/sw/qa/uitest/writer_tests7/tdf156900.py @@ -15,8 +15,6 @@ class tdf156900(UITestCase): def test_tdf156900(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # accept all tracked changes self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") diff --git a/sw/qa/uitest/writer_tests8/tdf156243.py b/sw/qa/uitest/writer_tests8/tdf156243.py index 461c9b508b86..522c7f1253e6 100644 --- a/sw/qa/uitest/writer_tests8/tdf156243.py +++ b/sw/qa/uitest/writer_tests8/tdf156243.py @@ -27,7 +27,7 @@ class tdf156243(UITestCase): self.assertEqual(enabled, get_state_as_dict(xCheckbox)["IsChecked"]) def test_tdf156243_Autocorrect_dialog(self): - with self.ui_test.create_doc_in_start_center("writer") as document: + with self.ui_test.create_doc_in_start_center("writer"): xWriterDoc = self.xUITest.getTopFocusWindow() xWriterEdit = xWriterDoc.getChild("writer_edit") try: |