mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Add some basic tests for urban dictionary
This commit is contained in:
parent
740ec40ace
commit
768f43ade9
4 changed files with 50 additions and 6 deletions
|
|
@ -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)
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue