Add some basic tests for urban dictionary

This commit is contained in:
Stijn De Clercq 2021-09-05 15:56:48 +02:00
parent 740ec40ace
commit 768f43ade9
4 changed files with 50 additions and 6 deletions

View file

@ -1,8 +1,7 @@
import os
from typing import Dict
import discord
import os
import requests
from typing import Dict
class Definition:
@ -28,7 +27,7 @@ class Definition:
try:
if word.lower() == "didier":
raise Exception
return Definition.define_didier()
response = requests.get(url, headers=headers, params=querystring).json()["list"]
@ -62,7 +61,7 @@ class Definition:
@staticmethod
def ratio(dic) -> float:
"""
Function that alculates the upvote/downvote ratio of the definition.
Function that calculates the upvote/downvote ratio of the definition.
:param dic: the dictionary representing the definition
:return: the upvote/downvote ratio (float)
"""