Testing/CI #21
@@ -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"))
|
||||||
Reference in New Issue
Block a user