diff --git a/PythonScript/python_tests/tests/test_CP1252FileCase.py b/PythonScript/python_tests/tests/test_CP1252FileCase.py index d6f72105..f86a092c 100644 --- a/PythonScript/python_tests/tests/test_CP1252FileCase.py +++ b/PythonScript/python_tests/tests/test_CP1252FileCase.py @@ -11,8 +11,8 @@ def tearDown(self): notepad.close() def test_simple_text_output(self): - editor.write(u'test123äöü'); + editor.write(u'test123äöü') text = editor.getText() - self.assertEqual(text, u'test123äöü'); + self.assertEqual(text, u'test123äöü') -suite = unittest.TestLoader().loadTestsFromTestCase(CP1252FileCase) \ No newline at end of file +suite = unittest.TestLoader().loadTestsFromTestCase(CP1252FileCase) diff --git a/PythonScript/python_tests/tests/test_ConsoleTestCase.py b/PythonScript/python_tests/tests/test_ConsoleTestCase.py index e69ff0a2..31cf0849 100644 --- a/PythonScript/python_tests/tests/test_ConsoleTestCase.py +++ b/PythonScript/python_tests/tests/test_ConsoleTestCase.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import unittest -from Npp import * +from Npp import console class ConsoleTestCase(unittest.TestCase): def setUp(self): @@ -17,4 +17,4 @@ def test_print_utf8_to_console(self): console.clear() -suite = unittest.TestLoader().loadTestsFromTestCase(ConsoleTestCase) \ No newline at end of file +suite = unittest.TestLoader().loadTestsFromTestCase(ConsoleTestCase) diff --git a/PythonScript/python_tests/tests/test_LineEndingMacTestCase.py b/PythonScript/python_tests/tests/test_LineEndingMacTestCase.py index ad1b6557..4aa2c33e 100644 --- a/PythonScript/python_tests/tests/test_LineEndingMacTestCase.py +++ b/PythonScript/python_tests/tests/test_LineEndingMacTestCase.py @@ -1 +1 @@ -# -*- coding: utf-8 -*- import unittest from Npp import notepad, editor class LineEndingMacTestCase(unittest.TestCase): def setUp(self): notepad.new() def tearDown(self): editor.setSavePoint() notepad.close() def test_simple_text_output(self): editor.write(u'test123äöü'); text = editor.getText() self.assertEqual(text, u'test123äöü'); suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingMacTestCase) \ No newline at end of file +# -*- coding: utf-8 -*- import unittest from Npp import notepad, editor class LineEndingMacTestCase(unittest.TestCase): def setUp(self): notepad.new() def tearDown(self): editor.setSavePoint() notepad.close() def test_simple_text_output(self): editor.write(u'test123äöü') text = editor.getText() self.assertEqual(text, u'test123äöü') suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingMacTestCase) \ No newline at end of file diff --git a/PythonScript/python_tests/tests/test_LineEndingUnixTestCase.py b/PythonScript/python_tests/tests/test_LineEndingUnixTestCase.py index 24c37ad7..c313c470 100644 --- a/PythonScript/python_tests/tests/test_LineEndingUnixTestCase.py +++ b/PythonScript/python_tests/tests/test_LineEndingUnixTestCase.py @@ -11,8 +11,8 @@ def tearDown(self): notepad.close() def test_simple_text_output(self): - editor.write(u'test123äöü'); + editor.write(u'test123äöü') text = editor.getText() - self.assertEqual(text, u'test123äöü'); + self.assertEqual(text, u'test123äöü') -suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingUnixTestCase) \ No newline at end of file +suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingUnixTestCase) diff --git a/PythonScript/python_tests/tests/test_MathTestCase.py b/PythonScript/python_tests/tests/test_MathTestCase.py index 05b0d21e..6157a674 100644 --- a/PythonScript/python_tests/tests/test_MathTestCase.py +++ b/PythonScript/python_tests/tests/test_MathTestCase.py @@ -12,4 +12,4 @@ def test_complex_abs(self): cplx = complex(-2, -1) self.assertAlmostEqual(abs(cplx), 2.236067977, places = 6) -suite = unittest.TestLoader().loadTestsFromTestCase(MathTestCase) \ No newline at end of file +suite = unittest.TestLoader().loadTestsFromTestCase(MathTestCase) diff --git a/PythonScript/python_tests/tests/test_NotepadCallbackTestCase.py b/PythonScript/python_tests/tests/test_NotepadCallbackTestCase.py index b34491e8..7aec63c3 100644 --- a/PythonScript/python_tests/tests/test_NotepadCallbackTestCase.py +++ b/PythonScript/python_tests/tests/test_NotepadCallbackTestCase.py @@ -3,18 +3,18 @@ import time import tempfile import os -from Npp import * +from Npp import notepad, editor, NOTIFICATION, LANGTYPE, SCINTILLANOTIFICATION globalCallbackCalled = False def dummy_callback(args): - global callbackCalled + global globalCallbackCalled editor.write('Dummy Callback called in error') globalCallbackCalled = True def global_poll_for_callback(timeout = 0.5, interval = 0.1): global globalCallbackCalled - while globalCallbackCalled == False and timeout > 0: + while (not globalCallbackCalled) and (timeout > 0): time.sleep(interval) timeout -= interval @@ -39,7 +39,7 @@ def get_temp_filename(self): return filename def poll_for_callback(self, timeout = 0.5, interval = 0.1): - while self.callbackCalled == False and timeout > 0: + while (not self.callbackCalled) and (timeout > 0): time.sleep(interval) timeout -= interval @@ -189,4 +189,4 @@ def callback_with_disallowed_sync_method(self, args): self.callbackCalled = True -suite = unittest.TestLoader().loadTestsFromTestCase(NotepadCallbackTestCase) \ No newline at end of file +suite = unittest.TestLoader().loadTestsFromTestCase(NotepadCallbackTestCase) diff --git a/PythonScript/python_tests/tests/test_NotepadTestCase.py b/PythonScript/python_tests/tests/test_NotepadTestCase.py index 9647aed7..63da991d 100644 --- a/PythonScript/python_tests/tests/test_NotepadTestCase.py +++ b/PythonScript/python_tests/tests/test_NotepadTestCase.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest -from Npp import * +from Npp import notepad, BUFFERENCODING, LANGTYPE class NotepadTestCase(unittest.TestCase): def setUp(self): @@ -43,4 +43,4 @@ def test_setLangType(self): -suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase) \ No newline at end of file +suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase) diff --git a/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py b/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py index 91b2b468..bb73ad93 100644 --- a/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py +++ b/PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py @@ -4,7 +4,8 @@ import os import shlex import tempfile -import ctypes, ctypes.wintypes +import ctypes +import ctypes.wintypes import xml.etree.ElementTree as et import time from threading import Timer @@ -404,7 +405,7 @@ def set_silent_updates(hwnd, lParam): if curr_class.value.lower() == u'button' and buff.value == u'Update silently': BM_SETCHECK = 0xF1 - BST_UNCHECKED = 0 + # BST_UNCHECKED = 0 BST_CHECKED = 1 ctypes.windll.user32.SendMessageW(hwnd,BM_SETCHECK, BST_CHECKED, None) @@ -660,7 +661,7 @@ def set_auto_updater(hwnd, lParam): if curr_class.value.lower() == u'button' and buff.value == u'Enable Notepad++ auto-updater': BM_SETCHECK = 0xF1 - BST_UNCHECKED = 0 + # BST_UNCHECKED = 0 BST_CHECKED = 1 ctypes.windll.user32.SendMessageW(hwnd,BM_SETCHECK, BST_CHECKED, None) diff --git a/PythonScript/python_tests/tests/test_ReplaceCountTestCase.py b/PythonScript/python_tests/tests/test_ReplaceCountTestCase.py index 0aeebccd..26975e75 100644 --- a/PythonScript/python_tests/tests/test_ReplaceCountTestCase.py +++ b/PythonScript/python_tests/tests/test_ReplaceCountTestCase.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest import re -from Npp import * +from Npp import notepad, editor class ReplaceStartEndTestCase(unittest.TestCase): def setUp(self): diff --git a/PythonScript/python_tests/tests/test_ReplaceFlagsTestCase.py b/PythonScript/python_tests/tests/test_ReplaceFlagsTestCase.py index 18bdc977..c4a305d3 100644 --- a/PythonScript/python_tests/tests/test_ReplaceFlagsTestCase.py +++ b/PythonScript/python_tests/tests/test_ReplaceFlagsTestCase.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest import re -from Npp import * +from Npp import notepad, editor class ReplaceFlagsTestCase(unittest.TestCase): def setUp(self): diff --git a/PythonScript/python_tests/tests/test_ReplacePlainTestCase.py b/PythonScript/python_tests/tests/test_ReplacePlainTestCase.py index d8c4f728..a4762cc3 100644 --- a/PythonScript/python_tests/tests/test_ReplacePlainTestCase.py +++ b/PythonScript/python_tests/tests/test_ReplacePlainTestCase.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- import unittest -from Npp import * -import re +from Npp import notepad, editor class ReplacePlainTestCase(unittest.TestCase): def setUp(self): notepad.new() notepad.runMenuCommand("Encoding", "Encode in UTF-8") - editor.write('Some text with ([abc]+) embedded regex\r\n'); + editor.write('Some text with ([abc]+) embedded regex\r\n') def tearDown(self): editor.setSavePoint() notepad.close() def test_plain_replace(self): - editor.replace(r'([abc]+)', 'TEST'); + editor.replace(r'([abc]+)', 'TEST') text = editor.getText() - self.assertEqual(text, 'Some text with TEST embedded regex\r\n'); + self.assertEqual(text, 'Some text with TEST embedded regex\r\n') def check_plain_search(self, m): self.called = True diff --git a/PythonScript/python_tests/tests/test_ReplaceStartEndTestCase.py b/PythonScript/python_tests/tests/test_ReplaceStartEndTestCase.py index f647265e..8c343124 100644 --- a/PythonScript/python_tests/tests/test_ReplaceStartEndTestCase.py +++ b/PythonScript/python_tests/tests/test_ReplaceStartEndTestCase.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest import re -from Npp import * +from Npp import notepad, editor class ReplaceStartEndTestCase(unittest.TestCase): def setUp(self): @@ -39,7 +39,7 @@ def test_replace_literal_start_later_end_sooner_2(self): text = editor.getText() self.assertEqual(text, u'AbcTESTDEF4567 ghi8910\r\nAbc123\r\n') - def test_replace_literal_start_later_end_sooner_2(self): + def test_replace_literal_start_later_end_sooner_3(self): editor.replace('123', 'TEST', re.IGNORECASE, 4, 18) text = editor.getText() self.assertEqual(text, u'Abc123DEF4567 ghi8910\r\nAbc123\r\n') diff --git a/PythonScript/python_tests/tests/test_ReplaceTestLastIndex.py b/PythonScript/python_tests/tests/test_ReplaceTestLastIndex.py index 7891fc7e..29c4dba9 100644 --- a/PythonScript/python_tests/tests/test_ReplaceTestLastIndex.py +++ b/PythonScript/python_tests/tests/test_ReplaceTestLastIndex.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import unittest -from Npp import * +from Npp import notepad, editor class ReplaceLastIndex(unittest.TestCase): diff --git a/PythonScript/python_tests/tests/test_ReplaceUTF8PythonFunction.py b/PythonScript/python_tests/tests/test_ReplaceUTF8PythonFunction.py index 2a0d07e1..5926ae57 100644 --- a/PythonScript/python_tests/tests/test_ReplaceUTF8PythonFunction.py +++ b/PythonScript/python_tests/tests/test_ReplaceUTF8PythonFunction.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import unittest -from Npp import * +from Npp import notepad, editor counter = 0 diff --git a/PythonScript/python_tests/tests/test_ReplaceUTF8TestCase.py b/PythonScript/python_tests/tests/test_ReplaceUTF8TestCase.py index 7a1be488..44f5a927 100644 --- a/PythonScript/python_tests/tests/test_ReplaceUTF8TestCase.py +++ b/PythonScript/python_tests/tests/test_ReplaceUTF8TestCase.py @@ -1,26 +1,26 @@ # -*- coding: utf-8 -*- import unittest -from Npp import * +from Npp import notepad, editor class ReplaceUTF8TestCase(unittest.TestCase): def setUp(self): notepad.new() notepad.runMenuCommand("Encoding", "Encode in UTF-8") - editor.write('Here is some text\r\nWith some umlauts XäXüXö\r\n'); + editor.write('Here is some text\r\nWith some umlauts XäXüXö\r\n') def tearDown(self): editor.setSavePoint() notepad.close() def test_simple_replace(self): - editor.rereplace(r'some\s([a-z]+)', 'TEST'); + editor.rereplace(r'some\s([a-z]+)', 'TEST') text = editor.getText() - self.assertEqual(text, 'Here is TEST\r\nWith TEST XäXüXö\r\n'); + self.assertEqual(text, 'Here is TEST\r\nWith TEST XäXüXö\r\n') def test_utf8_replace(self): - editor.rereplace(r'X[äö]', 'YY'); + editor.rereplace(r'X[äö]', 'YY') text = editor.getText() - self.assertEqual(text, 'Here is some text\r\nWith some umlauts YYXüYY\r\n'); + self.assertEqual(text, 'Here is some text\r\nWith some umlauts YYXüYY\r\n') def test_replace_condition(self): editor.rereplace('(Here)|(Xä)', '(?1Cheese)(?2Y)') diff --git a/PythonScript/python_tests/tests/test_ScintillaCallbackTestCase.py b/PythonScript/python_tests/tests/test_ScintillaCallbackTestCase.py index 425710a5..4e751c9b 100644 --- a/PythonScript/python_tests/tests/test_ScintillaCallbackTestCase.py +++ b/PythonScript/python_tests/tests/test_ScintillaCallbackTestCase.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- import unittest import time -from Npp import * +from Npp import notepad, editor, SCINTILLANOTIFICATION, MODIFICATIONFLAGS globalCallbackCalled = False def dummy_callback(args): - global callbackCalled + global globalCallbackCalled editor.write('Dummy Callback called in error') globalCallbackCalled = True def global_poll_for_callback(timeout = 0.5, interval = 0.1): global globalCallbackCalled - while globalCallbackCalled == False and timeout > 0: + while (not globalCallbackCalled) and (timeout > 0): time.sleep(interval) timeout -= interval @@ -196,7 +196,7 @@ def test_sync_disallowed_scintilla_method(self): def callback_sync_disallowed_scintilla_method(self, args): self.callbackCalled = True with self.assertRaisesRegex(RuntimeError, "not allowed in a synchronous"): - found = editor.findText(0, 0, editor.getLength(), 'Hello') + _ = editor.findText(0, 0, editor.getLength(), 'Hello') def test_sync_disallowed_notepad_method(self): editor.write('Hello world') @@ -207,7 +207,7 @@ def test_sync_disallowed_notepad_method(self): def callback_sync_disallowed_notepad_method(self, args): self.callbackCalled = True with self.assertRaisesRegex(RuntimeError, "not allowed in a synchronous"): - scintilla = notepad.createScintilla() + _ = notepad.createScintilla() def test_callback_with_replace(self): editor.callback(lambda a: self.callback_with_replace(a), [SCINTILLANOTIFICATION.MODIFIED]) @@ -223,7 +223,7 @@ def callback_with_replace(self, args): def poll_for_callback(self, timeout = 0.5, interval = 0.1): - while self.callbackCalled == False and timeout > 0: + while (not self.callbackCalled) and (timeout > 0): time.sleep(interval) timeout -= interval diff --git a/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py b/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py index e64c1d01..f3de7595 100644 --- a/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py +++ b/PythonScript/python_tests/tests/test_ScintillaWrapperTestCase.py @@ -4,7 +4,7 @@ from Npp import ( editor, notepad, SCINTILLANOTIFICATION, FINDOPTION, KEYMOD, - SCINTILLAMESSAGE, LEXER, MODIFICATIONFLAGS, LANGTYPE, Cell + SCINTILLAMESSAGE, MODIFICATIONFLAGS, LANGTYPE, Cell ) @@ -24,7 +24,7 @@ def tearDown(self): notepad.close() def poll_for_callback(self, timeout = 0.5, interval = 0.1): - while self.callbackCalled == False and timeout > 0: + while (not self.callbackCalled) and (timeout > 0): time.sleep(interval) timeout -= interval diff --git a/PythonScript/python_tests/tests/test_SearchUTF8TestCase.py b/PythonScript/python_tests/tests/test_SearchUTF8TestCase.py index 96c64ed1..28b43b65 100644 --- a/PythonScript/python_tests/tests/test_SearchUTF8TestCase.py +++ b/PythonScript/python_tests/tests/test_SearchUTF8TestCase.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest import re -from Npp import * +from Npp import notepad, editor counter = 0