Skip to content

Commit

Permalink
fix translation server unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenglinxiao committed Nov 7, 2019
1 parent 1979b34 commit 285b3c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion onmt/tests/test_translation_server.py
Expand Up @@ -112,13 +112,17 @@ def test_run(self):
sm = ServerModel(opt, model_id, model_root=model_root, load=True)
inp = [{"src": "hello how are you today"},
{"src": "good morning to you ."}]
results, scores, n_best, time = sm.run(inp)
results, scores, n_best, time, aligns = sm.run(inp)
self.assertIsInstance(results, list)
for sentence_string in results:
self.assertIsInstance(sentence_string, string_types)
self.assertIsInstance(scores, list)
for elem in scores:
self.assertIsInstance(elem, float)
self.assertIsInstance(aligns, list)
for align_string in aligns:
if align_string is not None:
self.assertIsInstance(align_string, string_types)
self.assertEqual(len(results), len(scores))
self.assertEqual(len(scores), len(inp))
self.assertEqual(n_best, 1)
Expand Down

0 comments on commit 285b3c7

Please sign in to comment.