mirror of
https://github.com/senju1337/senju.git
synced 2025-12-24 07:39:29 +00:00
tests: add some tests to test the methods of Haiku
Refs: OPS-70
This commit is contained in:
parent
0ce42f595c
commit
aa236775ba
1 changed files with 20 additions and 1 deletions
|
|
@ -4,12 +4,14 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
# do not remove this import. This is needed for
|
# do not remove this import. This is needed for
|
||||||
# pytest fixtures to work
|
# pytest fixtures to work
|
||||||
import pytest # noqa: F401
|
import pytest # noqa: F401
|
||||||
|
|
||||||
import senju # noqa: F401
|
import senju
|
||||||
|
from senju.haiku import Haiku # noqa: F401
|
||||||
|
|
||||||
# Note: these weird arguments are an indicator of what should be dome
|
# Note: these weird arguments are an indicator of what should be dome
|
||||||
# before. For example, `temp_data_dir` is a function in `conftest.py`. If we
|
# before. For example, `temp_data_dir` is a function in `conftest.py`. If we
|
||||||
|
|
@ -28,3 +30,20 @@ def test_temp_data_dir(temp_data_dir):
|
||||||
with open(testpath, "w") as f:
|
with open(testpath, "w") as f:
|
||||||
f.write("that dir actually works")
|
f.write("that dir actually works")
|
||||||
os.remove(testpath)
|
os.remove(testpath)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_haiku():
|
||||||
|
haiku = Haiku(["line number 1", "line number 2", "line number 3"])
|
||||||
|
print(haiku)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_haiku_json():
|
||||||
|
haiku = Haiku(["line number 1", "line number 2", "line number 3"])
|
||||||
|
data_raw: str = haiku.get_json()
|
||||||
|
data = json.loads(data_raw)
|
||||||
|
print(data)
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_haiku():
|
||||||
|
haiku = Haiku.request_haiku("apple banana papaya")
|
||||||
|
print(haiku)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue