コード例 #1
0
    def setUpClass(cls):
        """Set up the bot and Anime cog, as well as some premade anime elements"""

        cls.bot = commands.Bot(command_prefix='!')
        cls.animeCog = animecog.AnimeCog(cls.bot)
        cls.animeCog.source = _9anime._9Anime()
        cls.bot.add_cog(cls.animeCog)

        with open('test/test_data/9anime_1.html') as file:
            tree = html.fromstring(file.read())
            cls.animes1 = cls.animeCog.source._findAnimeElements(tree)
        with open('test/test_data/9anime_2.html') as file:
            tree = html.fromstring(file.read())
            cls.animes2 = cls.animeCog.source._findAnimeElements(tree)
コード例 #2
0
    async def setAnimeSource(self, ctx, source: str):
        """
        Set the anime source, i.e. where it will retrieve the anime from.

        :param ctx: The context.
        :param source: Name of the anime source.
        """
        if source.lower() == "gogoanime":
            self.source = gogoanime.GoGoAnime()
        elif source.lower() == "9anime":
            self.source = _9anime._9Anime()
        else:
            await ctx.send('Unknown or unsupported anime source.')
            return
        self.list.clear()
        self.fillCache()
        await ctx.send(f'Successfully set the anime source to {source}.')
コード例 #3
0
ファイル: test_9anime.py プロジェクト: Nksama/NaoTomori
 def setUp(self):
     self._9anime = _9Anime()
     with open('test/main/test_data/9anime_2.html') as file:
         tree = html.fromstring(file.read())
         self.animes = self._9anime._findAnimeElements(tree)
コード例 #4
0
ファイル: test_api.py プロジェクト: Nksama/NaoTomori
    def test_9anime(self):
        """Test 9Anime api"""

        _9anime = _9Anime()
        animes = _9anime.getRecent()
        self.assertTrue(len(animes) > 0)
コード例 #5
0
ファイル: test_9anime.py プロジェクト: newaccforhc/NaoTomori
 def setUp(self):
     self._9anime = _9Anime()