diff options
| author | Michal Nowikowski <godfryd@gmail.com> | 2014-08-01 07:16:37 +0200 |
|---|---|---|
| committer | Michal Nowikowski <godfryd@gmail.com> | 2014-08-01 07:16:37 +0200 |
| commit | b7f77794547d813c0d92f5b05ebf3b621dae37a4 (patch) | |
| tree | 52411cc02c13c0be0a53f1ba11344d19ac7e047d | |
| parent | b7045e48db560388554538e912a5bc184ced9d83 (diff) | |
| download | pylint-b7f77794547d813c0d92f5b05ebf3b621dae37a4.tar.gz | |
Fixes after review.
| -rw-r--r-- | checkers/spelling.py | 5 | ||||
| -rw-r--r-- | test/unittest_checker_spelling.py | 15 |
2 files changed, 17 insertions, 3 deletions
diff --git a/checkers/spelling.py b/checkers/spelling.py index 773f657..fccf964 100644 --- a/checkers/spelling.py +++ b/checkers/spelling.py @@ -146,7 +146,8 @@ class SpellingChecker(BaseTokenChecker): word = word.lower() # strip starting u' from unicode literals and r' from raw strings - if (word.startswith("u'") or word.startswith('u"') or word.startswith("r'") or word.startswith('r"')) and len(word) > 2: + if (word.startswith("u'") or word.startswith('u"') or + word.startswith("r'") or word.startswith('r"')) and len(word) > 2: word = word[2:] # if known word then continue @@ -159,7 +160,7 @@ class SpellingChecker(BaseTokenChecker): self.private_dict_file.write("%s\n" % word) self.unknown_words.add(word) else: - suggestions = self.spelling_dict.suggest(word)[:4] + suggestions = self.spelling_dict.suggest(word)[:4] # present upto 4 suggestions m = re.search("(\W|^)(%s)(\W|$)" % word, line.lower()) if m: diff --git a/test/unittest_checker_spelling.py b/test/unittest_checker_spelling.py index 2270b67..dcecaec 100644 --- a/test/unittest_checker_spelling.py +++ b/test/unittest_checker_spelling.py @@ -1,4 +1,17 @@ # Copyright 2014 Michal Nowikowski. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """Unittest for the spelling checker.""" import unittest import tokenize @@ -12,7 +25,7 @@ from pylint.testutils import CheckerTestCase, Message, set_config # try to create enchant dictionary try: import enchant -except: +except ImportError: enchant = None spell_dict = None |
