Skip to content

Commit 87843af

Browse files
committed
Merge pull request #117 from benoit-pierre/fix-suffix-folding
Fix suffix folding
2 parents dc2ddb0 + e6b9328 commit 87843af

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

plover/test_translation.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ def listener(undo, do, prev):
178178

179179
t.add_listener(listener)
180180

181-
expected = [([Translation([stroke('S')], dc)],
182-
[Translation([stroke('S'), stroke('P')], dc)],
183-
Translation([stroke('T')], dc))]
181+
expected = [([Translation([stroke('S')], None)],
182+
[Translation([stroke('S'), stroke('P')], 'hi')],
183+
Translation([stroke('T')], None))]
184184
t.translate(stroke('P'))
185185
self.assertEqual(output, expected)
186186

@@ -192,15 +192,15 @@ def listener(undo, do, prev):
192192
del output[:]
193193
t.clear_state()
194194
t.translate(stroke('P'))
195-
self.assertEqual(output, [([], [Translation([stroke('P')], dc)], None)])
195+
self.assertEqual(output, [([], [Translation([stroke('P')], None)], None)])
196196

197197
del output[:]
198198
t.set_state(s)
199199
t.translate(stroke('P'))
200200
self.assertEqual(output,
201201
[([],
202-
[Translation([stroke('P')], dc)],
203-
Translation([stroke('S'), stroke('P')], dc))])
202+
[Translation([stroke('P')], None)],
203+
Translation([stroke('S'), stroke('P')], 'hi'))])
204204

205205
def test_translator(self):
206206

@@ -335,10 +335,9 @@ def clear(self):
335335
class StateTestCase(unittest.TestCase):
336336

337337
def setUp(self):
338-
d = StenoDictionaryCollection()
339-
self.a = Translation([stroke('S')], d)
340-
self.b = Translation([stroke('T'), stroke('-D')], d)
341-
self.c = Translation([stroke('-Z'), stroke('P'), stroke('T*')], d)
338+
self.a = Translation([stroke('S')], None)
339+
self.b = Translation([stroke('T'), stroke('-D')], None)
340+
self.c = Translation([stroke('-Z'), stroke('P'), stroke('T*')], None)
342341

343342
def test_last_list0(self):
344343
s = _State()

plover/translation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, outline, translation):
6262
self.formatting = None
6363

6464
def __eq__(self, other):
65-
return self.rtfcre == other.rtfcre
65+
return self.rtfcre == other.rtfcre and self.english == other.english
6666

6767
def __ne__(self, other):
6868
return not self.__eq__(other)
@@ -290,7 +290,7 @@ def _find_translation(translations, dictionary, stroke):
290290
t = _find_translation_helper(translations, dictionary, stroke, SUFFIX_KEYS)
291291
if t:
292292
return t
293-
return Translation([stroke], _lookup([stroke], dictionary, []))
293+
return Translation([stroke], _lookup([stroke], dictionary, SUFFIX_KEYS))
294294

295295
def _find_translation_helper(translations, dictionary, stroke, suffixes):
296296
# The new stroke can either create a new translation or replace

0 commit comments

Comments
 (0)