This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_chatbot.py
77 lines (42 loc) · 1.96 KB
/
test_chatbot.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import numpy as np
from chatbot import clean_up_sentence
from chatbot import bow
from chatbot import classify
from chatbot import chat_response
def test_clean_up_hello_sentence_():
assert clean_up_sentence("Hi, HoW are you?!") == ['hi', ',', 'how', 'ar', 'you', '?', '!']
def test_bow_with_no_equality_():
assert bow("test", ["plop"]) == [0]
def test_bow_with_one_equality_():
assert bow("test", ["test"]) == [1]
def test_classify_greeting_sentence_():
assert classify("Hi")[0][0] == "greeting"
def test_classify_shutter_sentence_():
assert classify("bye")[0][0] == "goodbye"
def test_classify_camera_sentence_():
assert classify("camera")[0][0] == "take_photo"
def test_classify_light_sentence_():
assert classify("light")[0][0] == "hue"
def test_classify_type_greeting_():
assert type(classify("hi")[0][1]) == np.float32
def test_classify_type_thanks_():
assert type(classify("thanks")[0][1]) == np.float32
def test_classify_type_hue_():
assert type(classify("hue")[0][1]) == np.float32
def test_classify_type_rollers_():
assert type(classify("rollers")[0][1]) == np.float32
def test_chat_greeting_response_():
assert chat_response("Hi, HoW are you?!") == "Good to see you again" or "Hello, thanks for visiting" \
or "Hi there, how can I help?"
def test_chat_camera_response_():
assert chat_response("camera") == "exec camera_photo"
def test_chat_thanks_response_():
assert chat_response("thanks") == "Happy to help!" or "Any time!" or "My pleasure"
def test_chat_light_response_():
assert chat_response("philips hue") == "Ok, what mood do you want ?"
def test_contextual_hue_response_():
assert chat_response("philips hue") == "Ok, what mood do you want ?"
assert chat_response("relax") == "exec hue_relax"
def test_contextual_shutter_response_():
assert chat_response("shutter") == "Ok, do you want to open, close or stop ?"
assert chat_response("open") == "exec open_shutter"