-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handling of invalid values in the Search, Search, Replace and Replace…
… methods (#370) * Handling of invalid values in the Search, Search, Replace and Replace methods * fix typo
- Loading branch information
1 parent
4604de5
commit cb29713
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
PythonScript/python_tests/tests/test_SearchReplaceInvalidArgumentTestCase.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
import unittest | ||
from Npp import notepad, editor | ||
|
||
class SearchReplaceInvalidArgumentTestCase(unittest.TestCase): | ||
def setUp(self): | ||
notepad.new() | ||
|
||
def tearDown(self): | ||
notepad.close() | ||
|
||
def test_invalid_search_argument(self): | ||
for invalid_arg in ["", None]: | ||
for method in [editor.research, editor.search, editor.replace, editor.rereplace]: | ||
self.assertRaises(TypeError, method, invalid_arg, None) | ||
|
||
def test_invalid_replace_argument(self): | ||
for method in [editor.replace, editor.rereplace]: | ||
self.assertRaises(TypeError, method, "abc", None) | ||
|
||
|
||
suite = unittest.TestLoader().loadTestsFromTestCase(SearchReplaceInvalidArgumentTestCase) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters