import pytest, requests.exceptions, re, os
import translationbackends as tb
def hello(params):
t = tb.DeeplApi(**params)
assert t.translate("Hilfe") == "Help"
def cake(params):
t = tb.DeeplApi(**params)
assert t.translate("Der Kuchen wird kalt.") == "The cake is getting cold."
def deepl_web(params):
del params["api_key"]
t = tb.DeeplWeb(**params)
try:
assert t.translate("Hallo Welt.") == "Hello, world."
except requests.exceptions.HTTPError as exc:
if not re.match('429 Client Error', str(exc)):
raise exc