Compare commits
No commits in common. "02ffd07d72ed828e8528aa0d18ae5dc98fb224ed" and "31d7cc4284f907b42ed9071ec411dc797063fe4b" have entirely different histories.
02ffd07d72
...
31d7cc4284
|
@ -3,8 +3,6 @@ import json
|
|||
import os
|
||||
import time
|
||||
import signal
|
||||
import sys
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from typing import Any, Iterable, Optional
|
||||
|
||||
|
@ -125,11 +123,8 @@ class Bot(irc.client.SimpleIRCClient, Logger):
|
|||
self.start()
|
||||
except KeyboardInterrupt:
|
||||
self.log_i("Caught keyboard interrupt.")
|
||||
except Exception as exc:
|
||||
except Exception as exc: # Yes, I know, who are you going to call?
|
||||
self.log_c(f"Caught unhandled exception: {exc}")
|
||||
_, _, exc_traceback = sys.exc_info()
|
||||
for line in traceback.format_tb(exc_traceback):
|
||||
self.log_d(line.rstrip())
|
||||
finally:
|
||||
self.cleanup()
|
||||
|
||||
|
|
|
@ -15,17 +15,20 @@ class TestTranslatePlugin(unittest.TestCase):
|
|||
}
|
||||
|
||||
# No params.
|
||||
result = plugin.parse_words("test".split())
|
||||
result = plugin.parse_words(["test"])
|
||||
self.assertEqual(result, ("autodetect", "en", "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())
|
||||
# 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"])
|
||||
self.assertEqual(result, ("it", "fr", "test"))
|
||||
# Badly placed param.
|
||||
result = plugin.parse_words("from it test to fr".split())
|
||||
self.assertEqual(result, ("autodetect", "en", "from it test to fr"))
|
||||
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"))
|
||||
|
|
Loading…
Reference in a new issue