translate: fix unit tests

master
dece 2 years ago
parent 5f7f5db0ff
commit 02ffd07d72

@ -15,20 +15,17 @@ class TestTranslatePlugin(unittest.TestCase):
}
# No params.
result = plugin.parse_words(["test"])
result = plugin.parse_words("test".split())
self.assertEqual(result, ("autodetect", "en", "test"))
# Source param.
result = plugin.parse_words(["!from:fr", "test"])
self.assertEqual(result, ("fr", "en", "test"))
# Destination param.
result = plugin.parse_words(["!to:fr", "test"])
self.assertEqual(result, ("autodetect", "fr", "test"))
# Both source and dest params.
result = plugin.parse_words(["!from:it", "!to:fr", "test"])
# Source param (alone, so wrong).
result = plugin.parse_words("from fr test".split())
self.assertEqual(result, ("autodetect", "en", "from fr test"))
# Destination param (alone, so wrong).
result = plugin.parse_words("to fr test".split())
self.assertEqual(result, ("autodetect", "en", "to fr test"))
# Both source and dest params, OK.
result = plugin.parse_words("from it to fr test".split())
self.assertEqual(result, ("it", "fr", "test"))
# Badly placed param.
result = plugin.parse_words(["!from:it", "test", "!to:fr"])
self.assertEqual(result, ("it", "en", "test !to:fr"))
# Unknown param.
result = plugin.parse_words(["!zzz", "test"])
self.assertEqual(result, ("autodetect", "en", "test"))
result = plugin.parse_words("from it test to fr".split())
self.assertEqual(result, ("autodetect", "en", "from it test to fr"))

Loading…
Cancel
Save