This commit is contained in:
David Lawler 2022-03-09 14:59:14 +10:00
parent 248d2021be
commit 8518a1689f
4 changed files with 14 additions and 5 deletions

Binary file not shown.

View file

@ -1,6 +1,4 @@
import json
import pytest
def jaccard_similarity(userQuestion, questionBank):
s1 = set(userQuestion)

View file

@ -6,9 +6,20 @@ import pytest
# assert main.jaccard_similarity(float)
def test_likelyQuestion():
likelyQuestion = main.most_likely("weather today")
assert likelyQuestion['question'] == 'What is the weather like today?'
likelyQuestion = main.most_likely("birthday")
assert likelyQuestion['question'] == 'What is your birthday?'
def test_likelyAnswer():
likelyAnswer = main.most_likely("weather today")
assert likelyAnswer['answer'] == 'Same as yesterday.'
def test_detection_of_no_user_input():
# Override the Python built-in input method
main.main.input = lambda: ''
# Call the function you would like to test (which uses input)
output = main.main()
assert output == [
'Hello, I am a question answering bot.',
'Please enter a question, and press the ENTER key: ',
'Goodbye!'
]