clean
This commit is contained in:
parent
3af98b0270
commit
4dc987a85f
|
@ -90,11 +90,12 @@ class PlaylistOfTheDayPlugin(Plugin):
|
||||||
today.isoformat(),
|
today.isoformat(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def post_playlist(self, target):
|
def post_playlist(self, target: str) -> None:
|
||||||
playlist: list[str] = self.get_storage_value(self.PLAYLIST_KEY, [])
|
playlist: list[str] = self.get_storage_value(self.PLAYLIST_KEY, [])
|
||||||
if not playlist:
|
if not playlist:
|
||||||
self.bot.log_e("Playlist empty.")
|
self.bot.log_e("Playlist empty.")
|
||||||
self.signal_failure(target)
|
self.signal_failure(target)
|
||||||
|
return
|
||||||
|
|
||||||
linkified_items = map(PlaylistOfTheDayPlugin.linkify, playlist)
|
linkified_items = map(PlaylistOfTheDayPlugin.linkify, playlist)
|
||||||
html_items = map(lambda item: f"<li>{item}</li>", linkified_items)
|
html_items = map(lambda item: f"<li>{item}</li>", linkified_items)
|
||||||
|
@ -104,6 +105,7 @@ class PlaylistOfTheDayPlugin(Plugin):
|
||||||
if not url:
|
if not url:
|
||||||
self.bot.log_e("Shrlok returned None.")
|
self.bot.log_e("Shrlok returned None.")
|
||||||
self.signal_failure(target)
|
self.signal_failure(target)
|
||||||
|
return
|
||||||
|
|
||||||
date = self.get_storage_value(self.DATE_KEY, "")
|
date = self.get_storage_value(self.DATE_KEY, "")
|
||||||
if date != datetime.date.today().isoformat():
|
if date != datetime.date.today().isoformat():
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from unittest.mock import Mock, patch
|
|
||||||
|
|
||||||
from edmond.tests.test_plugin import get_plugin_patcher
|
from edmond.tests.test_plugin import get_plugin_patcher
|
||||||
from ..sleep import SleepPlugin
|
from ..sleep import SleepPlugin
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import unittest
|
|
||||||
|
|
||||||
from ..wikipedia import WikipediaPlugin
|
|
||||||
|
|
||||||
|
|
||||||
class TestWikipediaPlugin(unittest.TestCase):
|
|
||||||
def test_limit_text_length(self):
|
|
||||||
text = "lorem ipsum blah blah."
|
|
||||||
result = WikipediaPlugin.limit_text_length(text, max_length=10)
|
|
||||||
self.assertEqual(result, "lorem…")
|
|
||||||
result = WikipediaPlugin.limit_text_length(text, max_length=15)
|
|
||||||
self.assertEqual(result, "lorem ipsum…")
|
|
||||||
result = WikipediaPlugin.limit_text_length(text, max_length=30)
|
|
||||||
self.assertEqual(result, "lorem ipsum blah blah.")
|
|
|
@ -1,4 +1,5 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
import wikipedia
|
import wikipedia
|
||||||
|
|
Loading…
Reference in a new issue