-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_nlp_module.py
More file actions
27 lines (20 loc) · 819 Bytes
/
Copy pathtest_nlp_module.py
File metadata and controls
27 lines (20 loc) · 819 Bytes
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
import unittest
from main import NLPModule
class TestNLPModule(unittest.TestCase):
def setUp(self):
self.nlp = NLPModule()
def test_generate_text_retail(self):
prompt = "Where can I buy retail stock?"
result = self.nlp.generate_text(prompt)
self.assertTrue(hasattr(result, "text"))
self.assertEqual(result.expert, "Expert_Retail")
def test_generate_text_finance(self):
prompt = "What are the best finance investments?"
result = self.nlp.generate_text(prompt)
self.assertEqual(result.expert, "Expert_Finance")
def test_generate_text_general(self):
prompt = "Hello there!"
result = self.nlp.generate_text(prompt)
self.assertEqual(result.expert, "Expert_General")
if __name__ == '__main__':
unittest.main()