Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.

Commit 0595b54

Browse files
committed
test
1 parent 313ceeb commit 0595b54

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

__init__.py

Whitespace-only changes.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ pymongo==2.8
1111
pytz==2015.2
1212
six==1.9.0
1313
wsgiref==0.1.2
14-
unittest2==1.1.0
1514
celery==4.0.2
1615
requests==2.13.0
16+
pytest==3.2.3

test_chatbot.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import numpy as np
2+
3+
from chatbot import clean_up_sentence
4+
from chatbot import bow
5+
from chatbot import classify
6+
from chatbot import chat_response
7+
8+
9+
def test_clean_up_hello_sentence_():
10+
assert clean_up_sentence("Hi, HoW are you?!") == ['hi', ',', 'how', 'ar', 'you', '?', '!']
11+
12+
13+
def test_bow_with_no_equality_():
14+
assert bow("test", ["plop"]) == [0]
15+
16+
17+
def test_bow_with_one_equality_():
18+
assert bow("test", ["test"]) == [1]
19+
20+
21+
def test_classify_greeting_sentence_():
22+
assert classify("Hi")[0][0] == "greeting"
23+
24+
25+
def test_classify_shutter_sentence_():
26+
assert classify("bye")[0][0] == "goodbye"
27+
28+
29+
def test_classify_camera_sentence_():
30+
assert classify("camera")[0][0] == "take_photo"
31+
32+
33+
def test_classify_type_():
34+
assert type(classify("camera")[0][1]) == np.float32
35+
36+
37+
def test_chat_greeting_response_():
38+
assert chat_response("Hi, HoW are you?!") == "Good to see you again" or "Hello, thanks for visiting" \
39+
or "Hi there, how can I help?"
40+
41+
42+
def test_chat_camera_response_():
43+
assert chat_response("camera") == "exec camera_photo"
44+
45+
46+
def test_chat_thanks_response_():
47+
assert chat_response("thanks") == "Happy to help!" or "Any time!" or "My pleasure"

test_training.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import pickle
2+
3+
from chatbot import clean_up_sentence
4+
from chatbot import bow
5+
from chatbot import classify
6+
from chatbot import chat_response

0 commit comments

Comments
 (0)