Skip to content

Commit b08c46e

Browse files
authored
Two fixes, but mainly cleanups of Python test scripts to appease linters (bruderstein#364)
1 parent b9bde2d commit b08c46e

18 files changed

+46
-46
lines changed

PythonScript/python_tests/tests/test_CP1252FileCase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def tearDown(self):
1111
notepad.close()
1212

1313
def test_simple_text_output(self):
14-
editor.write(u'test123äöü');
14+
editor.write(u'test123äöü')
1515
text = editor.getText()
16-
self.assertEqual(text, u'test123äöü');
16+
self.assertEqual(text, u'test123äöü')
1717

18-
suite = unittest.TestLoader().loadTestsFromTestCase(CP1252FileCase)
18+
suite = unittest.TestLoader().loadTestsFromTestCase(CP1252FileCase)

PythonScript/python_tests/tests/test_ConsoleTestCase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
import unittest
3-
from Npp import *
3+
from Npp import console
44

55
class ConsoleTestCase(unittest.TestCase):
66
def setUp(self):
@@ -17,4 +17,4 @@ def test_print_utf8_to_console(self):
1717
console.clear()
1818

1919

20-
suite = unittest.TestLoader().loadTestsFromTestCase(ConsoleTestCase)
20+
suite = unittest.TestLoader().loadTestsFromTestCase(ConsoleTestCase)

PythonScript/python_tests/tests/test_LineEndingMacTestCase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# -*- coding: utf-8 -*-import unittestfrom Npp import notepad, editorclass 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)
1+
# -*- coding: utf-8 -*-import unittestfrom Npp import notepad, editorclass 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)

PythonScript/python_tests/tests/test_LineEndingUnixTestCase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def tearDown(self):
1111
notepad.close()
1212

1313
def test_simple_text_output(self):
14-
editor.write(u'test123äöü');
14+
editor.write(u'test123äöü')
1515
text = editor.getText()
16-
self.assertEqual(text, u'test123äöü');
16+
self.assertEqual(text, u'test123äöü')
1717

18-
suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingUnixTestCase)
18+
suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingUnixTestCase)

PythonScript/python_tests/tests/test_MathTestCase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ def test_complex_abs(self):
1212
cplx = complex(-2, -1)
1313
self.assertAlmostEqual(abs(cplx), 2.236067977, places = 6)
1414

15-
suite = unittest.TestLoader().loadTestsFromTestCase(MathTestCase)
15+
suite = unittest.TestLoader().loadTestsFromTestCase(MathTestCase)

PythonScript/python_tests/tests/test_NotepadCallbackTestCase.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
import time
44
import tempfile
55
import os
6-
from Npp import *
6+
from Npp import notepad, editor, NOTIFICATION, LANGTYPE, SCINTILLANOTIFICATION
77

88
globalCallbackCalled = False
99

1010
def dummy_callback(args):
11-
global callbackCalled
11+
global globalCallbackCalled
1212
editor.write('Dummy Callback called in error')
1313
globalCallbackCalled = True
1414

1515
def global_poll_for_callback(timeout = 0.5, interval = 0.1):
1616
global globalCallbackCalled
17-
while globalCallbackCalled == False and timeout > 0:
17+
while (not globalCallbackCalled) and (timeout > 0):
1818
time.sleep(interval)
1919
timeout -= interval
2020

@@ -39,7 +39,7 @@ def get_temp_filename(self):
3939
return filename
4040

4141
def poll_for_callback(self, timeout = 0.5, interval = 0.1):
42-
while self.callbackCalled == False and timeout > 0:
42+
while (not self.callbackCalled) and (timeout > 0):
4343
time.sleep(interval)
4444
timeout -= interval
4545

@@ -189,4 +189,4 @@ def callback_with_disallowed_sync_method(self, args):
189189
self.callbackCalled = True
190190

191191

192-
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadCallbackTestCase)
192+
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadCallbackTestCase)

PythonScript/python_tests/tests/test_NotepadTestCase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import unittest
4-
from Npp import *
4+
from Npp import notepad, BUFFERENCODING, LANGTYPE
55

66
class NotepadTestCase(unittest.TestCase):
77
def setUp(self):
@@ -43,4 +43,4 @@ def test_setLangType(self):
4343

4444

4545

46-
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase)
46+
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase)

PythonScript/python_tests/tests/test_NotepadWrapperTestCase.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import os
55
import shlex
66
import tempfile
7-
import ctypes, ctypes.wintypes
7+
import ctypes
8+
import ctypes.wintypes
89
import xml.etree.ElementTree as et
910
import time
1011
from threading import Timer
@@ -404,7 +405,7 @@ def set_silent_updates(hwnd, lParam):
404405

405406
if curr_class.value.lower() == u'button' and buff.value == u'Update silently':
406407
BM_SETCHECK = 0xF1
407-
BST_UNCHECKED = 0
408+
# BST_UNCHECKED = 0
408409
BST_CHECKED = 1
409410

410411
ctypes.windll.user32.SendMessageW(hwnd,BM_SETCHECK, BST_CHECKED, None)
@@ -660,7 +661,7 @@ def set_auto_updater(hwnd, lParam):
660661

661662
if curr_class.value.lower() == u'button' and buff.value == u'Enable Notepad++ auto-updater':
662663
BM_SETCHECK = 0xF1
663-
BST_UNCHECKED = 0
664+
# BST_UNCHECKED = 0
664665
BST_CHECKED = 1
665666

666667
ctypes.windll.user32.SendMessageW(hwnd,BM_SETCHECK, BST_CHECKED, None)

PythonScript/python_tests/tests/test_ReplaceCountTestCase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import unittest
33
import re
4-
from Npp import *
4+
from Npp import notepad, editor
55

66
class ReplaceStartEndTestCase(unittest.TestCase):
77
def setUp(self):

PythonScript/python_tests/tests/test_ReplaceFlagsTestCase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import unittest
33
import re
4-
from Npp import *
4+
from Npp import notepad, editor
55

66
class ReplaceFlagsTestCase(unittest.TestCase):
77
def setUp(self):

0 commit comments

Comments
 (0)