-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_Chatbot.py
More file actions
61 lines (32 loc) · 969 Bytes
/
Copy pathtest_Chatbot.py
File metadata and controls
61 lines (32 loc) · 969 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from chatbot import Chatbot
def test_greeting():
bot = Chatbot()
response = bot.respond("hello")
assert "Hello" in response
def test_name():
bot = Chatbot()
response = bot.respond("what is your name")
assert "PyBot" in response
def test_python_question():
bot = Chatbot()
response = bot.respond("tell me about python")
assert "Python" in response
def test_empty_input():
bot = Chatbot()
response = bot.respond("")
assert response == "Please enter a message."
def test_unknown_input():
bot = Chatbot()
response = bot.respond("something random")
assert "not sure" in response
def test_conversation_history():
bot = Chatbot()
bot.respond("hello")
history = bot.get_history()
assert "hello" in history
assert "Hello" in history
def test_clear_history():
bot = Chatbot()
bot.respond("hello")
bot.clear_history()
assert bot.conversation_history == []