From c70bb1284fbb6a4c98f629529e2b6361e7666c0e Mon Sep 17 00:00:00 2001 From: Jan-Paul van Osta Date: Sat, 10 Dec 2022 22:26:13 +0100 Subject: [PATCH] eerste test voor chatbot --- tests/chatbot.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/chatbot.py diff --git a/tests/chatbot.py b/tests/chatbot.py new file mode 100644 index 0000000..d5cf629 --- /dev/null +++ b/tests/chatbot.py @@ -0,0 +1,36 @@ +import unittest +import praw +import dotenv +import re + +import discord +from discord.ext import commands + +import Chatbot + +class TestGeneral(unittest.TestCase): + def setUp(self): + dotenv.load_dotenv() + intents = discord.Intents.default() + intents.message_content = True + intents.members = True + bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True, intents=intents) + self.cog = Chatbot.Chatbot(bot) + + def test_countsyllables(self): + with self.subTest("1 syllable word"): + self.assertEqual(1, self.cog.countSyllables("big")) + with self.subTest("1 syllable word (longer)"): + self.assertEqual(1, self.cog.countSyllables("Paard")) + with self.subTest("2 syllable word"): + self.assertEqual(2, self.cog.countSyllables("Bakfiets")) + with self.subTest("2 syllable word (more complex)"): + self.assertEqual(2, self.cog.countSyllables("Skiƫn")) + with self.subTest("3 syllable word"): + self.assertEqual(3, self.cog.countSyllables("Spookpoeper")) + with self.subTest("4 syllable word"): + self.assertEqual(4, self.cog.countSyllables("Papzakprobleem")) + with self.subTest("8 syllable word"): + self.assertEqual(8, self.cog.countSyllables("zuremattenvampirisme")) + with self.subTest("OMG"): + self.assertEqual(3, self.cog.countSyllables("OMG"))