Skip to content

Commit bfef71f

Browse files
committed
- add coding info to python_tests files
- removed whitespaces
1 parent 148bec9 commit bfef71f

17 files changed

+80
-78
lines changed

PythonScript/python_tests/RunTests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
if hasattr(test_suite, 'suite'):
2222
test_suites.append(test_suite.suite)
2323

24-
24+
2525
alltests = unittest.TestSuite(test_suites)
2626

2727
console.show()
@@ -42,7 +42,7 @@ def writeTestFailure(error):
4242
if results.errors:
4343
for error in results.errors:
4444
writeTestFailure(error)
45-
45+
4646
if results.failures:
4747
for error in results.failures:
4848
writeTestFailure(error)

PythonScript/python_tests/tests/ConsoleTestCase.py

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

PythonScript/python_tests/tests/MathTestCase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ def tearDown(self):
1010

1111
def test_complex_abs(self):
1212
cplx = complex(-2, -1)
13-
self.assertAlmostEqual(abs(cplx), 2.236067977, places = 6)
13+
self.assertAlmostEqual(abs(cplx), 2.236067977, places = 6)
1414

1515
suite = unittest.TestLoader().loadTestsFromTestCase(MathTestCase)

PythonScript/python_tests/tests/NotepadCallbackTestCase.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import unittest
23
import time
34
import tempfile
@@ -57,7 +58,7 @@ def callback_nested(self, args):
5758
if langType == LANGTYPE.PHP: # first call
5859
notepad.setLangType(LANGTYPE.PYTHON)
5960
elif langType == LANGTYPE.PYTHON: # second call
60-
notepad.setLangType(LANGTYPE.XML)
61+
notepad.setLangType(LANGTYPE.XML)
6162
elif langType == LANGTYPE.XML:
6263
self.callbackCalled = True
6364

@@ -162,13 +163,13 @@ def test_notepad_callback_from_editor_callback(self):
162163

163164

164165
def test_notepad_callback_with_disallowed_sync_method(self):
165-
"""This checks calling a method in a n++ callback, that is not allowed in
166-
a synchronous Scintilla callback - specifically because N++ callbacks are synchronous, but
166+
"""This checks calling a method in a n++ callback, that is not allowed in
167+
a synchronous Scintilla callback - specifically because N++ callbacks are synchronous, but
167168
allow all methods"""
168169

169170
editor.write('File 1')
170171
notepad.saveAs(self.get_temp_filename())
171-
self.oldBufferID = notepad.getCurrentBufferID()
172+
self.oldBufferID = notepad.getCurrentBufferID()
172173
notepad.new()
173174
editor.write('File 2')
174175
notepad.saveAs(self.get_temp_filename())
@@ -182,7 +183,7 @@ def test_notepad_callback_with_disallowed_sync_method(self):
182183
self.assertTrue(self.callbackCalled)
183184
self.assertEqual(self.oldBufferID, currentBufferID)
184185

185-
186+
186187
def callback_with_disallowed_sync_method(self, args):
187188
notepad.activateBufferID(self.oldBufferID)
188189
self.callbackCalled = True

PythonScript/python_tests/tests/NotepadTestCase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_setLangType(self):
2828
notepad.new()
2929
buffer2 = notepad.getCurrentBufferID()
3030
notepad.setLangType(LANGTYPE.PHP)
31-
31+
3232
notepad.activateBufferID(buffer1)
3333
newBuffer1Lang = notepad.getLangType()
3434
notepad.activateBufferID(buffer2)
@@ -37,7 +37,7 @@ def test_setLangType(self):
3737
notepad.close()
3838
notepad.activateBufferID(buffer1)
3939
notepad.close()
40-
40+
4141
self.assertEqual(newBuffer1Lang, LANGTYPE.C)
4242
self.assertEqual(newBuffer2Lang, LANGTYPE.PHP)
4343

PythonScript/python_tests/tests/ReplaceAnsiPythonFunction.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- coding: utf-8 -*-
1+
# -*- coding: utf-8 -*-
22
import unittest
33
from Npp import notepad, editor
44

@@ -19,7 +19,7 @@ def group1_with_counter(m):
1919

2020

2121

22-
22+
2323

2424
class ReplaceAnsiPythonFunctionTestCase(unittest.TestCase):
2525
def setUp(self):
@@ -28,25 +28,25 @@ def setUp(self):
2828
notepad.new()
2929
notepad.runMenuCommand("Encoding", "Convert to ANSI")
3030
editor.write(u'abc123 def5432 gh98\r\näbc123 üef5432 öh98\r\n'.encode('windows-1252'))
31-
31+
3232
def tearDown(self):
3333
editor.setSavePoint()
3434
notepad.close()
35-
35+
3636
def test_replace_function(self):
3737
editor.rereplace(r'([a-z]+)([0-9]+)'.encode('windows-1252'), group2_with_counter)
3838
text = editor.getText()
3939
self.assertEqual(text, u'1231 54322 983\r\nä1234 ü54325 ö986\r\n'.encode('windows-1252'))
40-
40+
4141
def test_unicode_replace_function(self):
4242
editor.rereplace(ur'([a-zäöü]+)([0-9]+)', group1_with_counter)
4343
text = editor.getText()
4444
self.assertEqual(text, u'abc1 def2 gh3\r\näbc4 üef5 öh6\r\n'.encode('windows-1252'))
45-
45+
4646
def groups_check(self, m):
4747
global counter
4848
counter += 1
49-
groups_data_correct = { 1 : ('abc', '123'),
49+
groups_data_correct = { 1 : ('abc', '123'),
5050
2 : ('def', '5432'),
5151
3 : ('gh', '98'),
5252
4 : (u'äbc'.encode('windows-1252'), '123'),
@@ -80,15 +80,15 @@ def test_named_groups_2(self):
8080
def group_tuples_check(self, m):
8181
global counter
8282
counter += 1
83-
groups_data_correct = { 1 : ('123', 'abc', '123'),
83+
groups_data_correct = { 1 : ('123', 'abc', '123'),
8484
2 : ('5432', 'def', '5432'),
8585
3 : ('98', 'gh', '98'),
8686
4 : ('123', '\xe4bc', '123'),
8787
5 : ('5432', u'üef'.encode('windows-1252'), '5432'),
8888
6 : ('98', u'öh'.encode('windows-1252'), '98') }
8989
self.assertEqual(m.group(2, 'letters', 'numbers'), groups_data_correct[counter])
9090
return counter
91-
91+
9292
def test_group_tuples(self):
9393
editor.rereplace(ur'(?<letters>[a-zäöü]+)(?<numbers>[0-9]+)', lambda m: self.group_tuples_check(m))
9494
text = editor.getText()

PythonScript/python_tests/tests/ReplaceAnsiTestCase.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- coding: utf-8 -*-
1+
# -*- coding: utf-8 -*-
22
import unittest
33
from Npp import notepad, editor
44

@@ -7,16 +7,16 @@ def setUp(self):
77
notepad.new()
88
notepad.runMenuCommand("Encoding", "Convert to ANSI")
99
editor.write(u'Here is some text\r\nWith some umlauts XäXüXö\r\n'.encode('windows-1252'));
10-
10+
1111
def tearDown(self):
1212
editor.setSavePoint()
1313
notepad.close()
14-
14+
1515
def test_simple_replace(self):
1616
editor.rereplace(r'some\s([a-z]+)', 'TEST');
1717
text = editor.getText()
1818
self.assertEqual(text, u'Here is TEST\r\nWith TEST XäXüXö\r\n'.encode('windows-1252'));
19-
19+
2020
def test_ansi_replace(self):
2121
editor.rereplace(u'X[äö]'.encode('windows-1252'), 'YY');
2222
text = editor.getText()
@@ -25,7 +25,7 @@ def test_ansi_replace(self):
2525
def test_unicode_replace(self):
2626
editor.rereplace(u'X[äö]', 'PP');
2727
text = editor.getText()
28-
self.assertEqual(text, u'Here is some text\r\nWith some umlauts PPXüPP\r\n'.encode('windows-1252'));
28+
self.assertEqual(text, u'Here is some text\r\nWith some umlauts PPXüPP\r\n'.encode('windows-1252'));
2929

3030
def test_replace_with_unicode(self):
3131
editor.rereplace('Here|With', u'XäöüY')

PythonScript/python_tests/tests/ReplaceCountTestCase.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ def setUp(self):
88
notepad.new()
99
notepad.runMenuCommand("Encoding", "Encode in UTF-8")
1010
editor.write(u'Abc123DEF4567 ghi8910\r\nAbc123\r\n')
11-
11+
1212
def tearDown(self):
1313
editor.setSavePoint()
1414
notepad.close()
15-
15+
1616
def test_replace_limit_3(self):
1717
editor.rereplace(r'([A-Z]{3})', 'TEST', re.IGNORECASE, 0, 0, 3)
1818
text = editor.getText()
1919
self.assertEqual(text, u'TEST123TEST4567 TEST8910\r\nAbc123\r\n')
20-
20+
2121
def test_replace_limit_2(self):
2222
editor.rereplace(r'([A-Z]{3})', 'TEST', re.IGNORECASE, 0, 0, 2)
2323
text = editor.getText()
2424
self.assertEqual(text, u'TEST123TEST4567 ghi8910\r\nAbc123\r\n')
2525

26-
26+
2727
def test_replace_literal_count_1(self):
2828
editor.replace(r'Abc', 'TEST', re.IGNORECASE, 0, 0, 1)
2929
text = editor.getText()

PythonScript/python_tests/tests/ReplaceFlagsTestCase.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- coding: utf-8 -*-
1+
# -*- coding: utf-8 -*-
22
import unittest
33
import re
44
from Npp import *
@@ -8,16 +8,16 @@ def setUp(self):
88
notepad.new()
99
notepad.runMenuCommand("Encoding", "Encode in UTF-8")
1010
editor.write(u'Abc123DEF4567 ghi8910\r\nAbc123\r\n')
11-
11+
1212
def tearDown(self):
1313
editor.setSavePoint()
1414
notepad.close()
15-
15+
1616
def test_replace_is_case_sensitive(self):
1717
editor.rereplace(r'([A-Z]{3})', 'TEST')
1818
text = editor.getText()
1919
self.assertEqual(text, u'Abc123TEST4567 ghi8910\r\nAbc123\r\n')
20-
20+
2121
def test_replace_case_insensitive(self):
2222
editor.rereplace(r'([A-Z]{3})', 'TEST', re.IGNORECASE)
2323
text = editor.getText()

PythonScript/python_tests/tests/ReplacePlainTestCase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ def setUp(self):
88
notepad.new()
99
notepad.runMenuCommand("Encoding", "Encode in UTF-8")
1010
editor.write('Some text with ([abc]+) embedded regex\r\n');
11-
11+
1212
def tearDown(self):
1313
editor.setSavePoint()
1414
notepad.close()
15-
15+
1616
def test_plain_replace(self):
1717
editor.replace(r'([abc]+)', 'TEST');
1818
text = editor.getText()
@@ -21,7 +21,7 @@ def test_plain_replace(self):
2121
def check_plain_search(self, m):
2222
self.called = True
2323
self.assertEqual('([abc]+)', m.group())
24-
24+
2525
def test_plain_search(self):
2626
self.called = False
2727
editor.search(r'([abc]+)', lambda m: self.check_plain_search(m))

0 commit comments

Comments
 (0)