Commit 4659dda5 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

testSpellChecking: py3.

parent 29ca0cbc
...@@ -58,7 +58,7 @@ class Aspell(object): ...@@ -58,7 +58,7 @@ class Aspell(object):
command = 'echo %s | aspell -l %s -a' % (word, language) command = 'echo %s | aspell -l %s -a' % (word, language)
subprocess = Popen(command, shell=True, stdin=PIPE, subprocess = Popen(command, shell=True, stdin=PIPE,
stdout=PIPE, stderr=PIPE, close_fds=True) stdout=PIPE, stderr=PIPE, close_fds=True)
return subprocess.communicate()[0].split('\n')[1:] return subprocess.communicate()[0].decode('utf-8').split('\n')[1:]
class TestSpellChecking(ERP5TypeTestCase): class TestSpellChecking(ERP5TypeTestCase):
...@@ -115,7 +115,7 @@ class TestSpellChecking(ERP5TypeTestCase): ...@@ -115,7 +115,7 @@ class TestSpellChecking(ERP5TypeTestCase):
message = '"%s" is misspelled, suggestion are : "%s"' message = '"%s" is misspelled, suggestion are : "%s"'
result_dict = {} result_dict = {}
for word, result_list in six.iteritems(self.spellChecker(sentence)): for word, result_list in six.iteritems(self.spellChecker(sentence)):
filtered_result_list = filter(lambda x: x not in ('*', ''), result_list) filtered_result_list = [x for x in result_list if x not in ('*', '')]
if filtered_result_list: if filtered_result_list:
result_dict[word] = message % (word, \ result_dict[word] = message % (word, \
filtered_result_list[0].split(':')[-1].strip()) filtered_result_list[0].split(':')[-1].strip())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment