Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PythonScript/python_tests/tests/test_CP1252FileCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
suite = unittest.TestLoader().loadTestsFromTestCase(CP1252FileCase)
4 changes: 2 additions & 2 deletions PythonScript/python_tests/tests/test_ConsoleTestCase.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
from Npp import *
from Npp import console

class ConsoleTestCase(unittest.TestCase):
def setUp(self):
Expand All @@ -17,4 +17,4 @@ def test_print_utf8_to_console(self):
console.clear()


suite = unittest.TestLoader().loadTestsFromTestCase(ConsoleTestCase)
suite = unittest.TestLoader().loadTestsFromTestCase(ConsoleTestCase)
Original file line number Diff line number Diff line change
@@ -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)
# -*- 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
suite = unittest.TestLoader().loadTestsFromTestCase(LineEndingUnixTestCase)
2 changes: 1 addition & 1 deletion PythonScript/python_tests/tests/test_MathTestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
suite = unittest.TestLoader().loadTestsFromTestCase(MathTestCase)
10 changes: 5 additions & 5 deletions PythonScript/python_tests/tests/test_NotepadCallbackTestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -189,4 +189,4 @@ def callback_with_disallowed_sync_method(self, args):
self.callbackCalled = True


suite = unittest.TestLoader().loadTestsFromTestCase(NotepadCallbackTestCase)
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadCallbackTestCase)
4 changes: 2 additions & 2 deletions PythonScript/python_tests/tests/test_NotepadTestCase.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -43,4 +43,4 @@ def test_setLangType(self):



suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase)
suite = unittest.TestLoader().loadTestsFromTestCase(NotepadTestCase)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
9 changes: 4 additions & 5 deletions PythonScript/python_tests/tests/test_ReplacePlainTestCase.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
from Npp import *
from Npp import notepad, editor


class ReplaceLastIndex(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
from Npp import *
from Npp import notepad, editor

counter = 0

Expand Down
12 changes: 6 additions & 6 deletions PythonScript/python_tests/tests/test_ReplaceUTF8TestCase.py
Original file line number Diff line number Diff line change
@@ -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)')
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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')
Expand All @@ -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])
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from Npp import (
editor, notepad, SCINTILLANOTIFICATION, FINDOPTION, KEYMOD,
SCINTILLAMESSAGE, LEXER, MODIFICATIONFLAGS, LANGTYPE, Cell
SCINTILLAMESSAGE, MODIFICATIONFLAGS, LANGTYPE, Cell
)


Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion PythonScript/python_tests/tests/test_SearchUTF8TestCase.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import unittest
import re
from Npp import *
from Npp import notepad, editor

counter = 0

Expand Down