Babelize wasn't properly setting the language when it terminated early

This commit is contained in:
James Vega 2004-06-09 23:43:37 +00:00
parent 5633b9d46b
commit 32f39e0980
2 changed files with 2 additions and 0 deletions

View File

@ -143,6 +143,7 @@ def babelize(phrase, from_language, through_language, limit = 12, callback = Non
for i in range(limit): for i in range(limit):
phrase = translate(phrase, next, flip[next]) phrase = translate(phrase, next, flip[next])
if seen.has_key(phrase): if seen.has_key(phrase):
next = flip[next]
break break
seen[phrase] = 1 seen[phrase] = 1
if callback: if callback:

View File

@ -45,6 +45,7 @@ if network:
def testBabelize(self): def testBabelize(self):
self.assertNotError('babelize en sp foo') self.assertNotError('babelize en sp foo')
self.assertError('babelize sp fr foo') self.assertError('babelize sp fr foo')
self.assertResponse('babelize german english sprache', 'language')
def testRandomlanguage(self): def testRandomlanguage(self):
self.assertNotError('randomlanguage') self.assertNotError('randomlanguage')