-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_app.py
43 lines (33 loc) · 1.48 KB
/
test_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
Tests for app.py using unittest.
Implementation of unit tests that collectively test
the implementation of functions from app.py thoroughly.
"""
import unittest
import gradio
import app
class TestApp(unittest.TestCase):
def test_openai_api_key(self):
"""Test that the openai_api_key function returns a string"""
self.assertIsInstance(app.openai_api_key, str)
def test_start_sequence(self):
"""Test that the start_sequence variable returns a string"""
self.assertIsInstance(app.start_sequence, str)
def test_restart_sequence(self):
"""Test that the restart_sequence variable returns a string"""
self.assertIsInstance(app.restart_sequence, str)
def test_prompt(self):
"""Test that the prompt variable returns a string"""
self.assertIsInstance(app.prompt, str)
def test_read(self):
"""Test that the read function returns a string"""
self.assertIsInstance(app.read("initial.txt"), str)
def test_api_request(self):
"""Test that the api_request function returns a string"""
self.assertIsInstance(app.api_request("Hello"), str)
def test_chat_brain(self):
"""Test that the chat_brain function returns a tuple"""
self.assertIsInstance(app.chat_brain("Hello", []), tuple)
def test_gradio_block(self):
"""Test that the gradio block returns a gradio object"""
self.assertIsInstance(app.block, gradio.Blocks)