translate: fix unit tests
This commit is contained in:
parent
5f7f5db0ff
commit
02ffd07d72
|
@ -15,20 +15,17 @@ class TestTranslatePlugin(unittest.TestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
# No params.
|
# No params.
|
||||||
result = plugin.parse_words(["test"])
|
result = plugin.parse_words("test".split())
|
||||||
self.assertEqual(result, ("autodetect", "en", "test"))
|
self.assertEqual(result, ("autodetect", "en", "test"))
|
||||||
# Source param.
|
# Source param (alone, so wrong).
|
||||||
result = plugin.parse_words(["!from:fr", "test"])
|
result = plugin.parse_words("from fr test".split())
|
||||||
self.assertEqual(result, ("fr", "en", "test"))
|
self.assertEqual(result, ("autodetect", "en", "from fr test"))
|
||||||
# Destination param.
|
# Destination param (alone, so wrong).
|
||||||
result = plugin.parse_words(["!to:fr", "test"])
|
result = plugin.parse_words("to fr test".split())
|
||||||
self.assertEqual(result, ("autodetect", "fr", "test"))
|
self.assertEqual(result, ("autodetect", "en", "to fr test"))
|
||||||
# Both source and dest params.
|
# Both source and dest params, OK.
|
||||||
result = plugin.parse_words(["!from:it", "!to:fr", "test"])
|
result = plugin.parse_words("from it to fr test".split())
|
||||||
self.assertEqual(result, ("it", "fr", "test"))
|
self.assertEqual(result, ("it", "fr", "test"))
|
||||||
# Badly placed param.
|
# Badly placed param.
|
||||||
result = plugin.parse_words(["!from:it", "test", "!to:fr"])
|
result = plugin.parse_words("from it test to fr".split())
|
||||||
self.assertEqual(result, ("it", "en", "test !to:fr"))
|
self.assertEqual(result, ("autodetect", "en", "from it test to fr"))
|
||||||
# Unknown param.
|
|
||||||
result = plugin.parse_words(["!zzz", "test"])
|
|
||||||
self.assertEqual(result, ("autodetect", "en", "test"))
|
|
||||||
|
|
Loading…
Reference in a new issue