25 lines
No EOL
850 B
Python
25 lines
No EOL
850 B
Python
import main
|
|
import pytest
|
|
|
|
#def test_CanInstantiatejaccard_similarity():
|
|
# co = main.jaccard_similarity(userQuestion="Weather", questionBank="Same as yesterday.")
|
|
# assert main.jaccard_similarity(float)
|
|
|
|
def test_likelyQuestion():
|
|
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!'
|
|
] |