def test_disambiguate(): print("Testing disambiguate() functionality...") chatbot = Chatbot(True) clarification = "1997" candidates = [1359, 2716] if assertListEquals( chatbot.disambiguate(clarification, candidates), [1359], "Incorrect output for disambiguate('{}', {})".format( clarification, candidates), orderMatters=False) and assertListEquals( chatbot.disambiguate("2", [1142, 1357, 2629, 546]), [1357], "Incorrect output for disambiguate('{}', {})".format( "2", [1142, 1357, 2629, 546]), orderMatters=False) and assertListEquals( chatbot.disambiguate("Sorcerer's Stone", [ 3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842 ]), [3812], "Incorrect output for disambiguate('{}', {})".format( "Sorcerer's Stone", [3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842]), orderMatters=False): print('disambiguate() sanity check passed!') print() return True
def test_disambiguate(): print("Testing disambiguate() functionality...") chatbot = Chatbot(True) clarification1 = "1997" candidates1 = [1359, 2716] clarification2 = "2" candidates2 = [1142, 1357, 2629, 546] clarification3 = "sorcerer's stone" candidates3 = [3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842] clarification4 = "that darn cat!" candidates4 = [822, 1090, 1182, 1599] # [822] clarification5 = "That Darn Cat" candidates5 = [822, 1090, 1182, 1599] # [1182] # Ending punctuation cases """ and assertListEquals( chatbot.disambiguate(clarification4, candidates4), [822], "Incorrect output for disambiguate('{}', {})".format(clarification4, candidates4), orderMatters=False ) and assertListEquals( chatbot.disambiguate(clarification5, candidates5), [1182], "Incorrect output for disambiguate('{}', {})".format(clarification5, candidates5), orderMatters=False ) """ if assertListEquals( chatbot.disambiguate(clarification1, candidates1), [1359], "Incorrect output for disambiguate('{}', {})".format(clarification1, candidates1), orderMatters=False ) and assertListEquals( chatbot.disambiguate(clarification2, candidates2), [1357], "Incorrect output for disambiguate('{}', {})".format(clarification2, candidates2), orderMatters=False ) and assertListEquals( chatbot.disambiguate(clarification3, candidates3), [3812], "Incorrect output for disambiguate('{}', {})".format(clarification3, candidates3), orderMatters=False ): print('disambiguate() sanity check passed!') print() return True
def test_disambiguate_complex(): print("Testing complex disambiguate() functionality...") chatbot = Chatbot(True) # add more test cases here!!! test_cases = [ ('2', [8082, 4511, 1664], [4511]), ('most recent', [524, 5743], [1524]), ('the Goblet of Fire one', [3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842], [6294]), ('the second one', [3812, 6294, 4325, 5399, 6735, 7274, 7670, 7842], [6294]), ] tests_passed = True for clarification, candidates, expected_output in test_cases: if not assertListEquals( chatbot.disambiguate(clarification, candidates), expected_output, "Incorrect output for complex disambiguate('{}', {})".format( clarification, candidates), orderMatters=False): tests_passed = False if tests_passed: print('complex disambiguate() sanity check passed!') print() return True
def test_disambiguate(): print("Testing disambiguate() functionality...") chatbot = Chatbot(True) # add more test cases here!!! test_cases = [ ('1997', [1359, 2716], [1359]), ('2', [1142, 1357, 2629, 546], [1357]), ('Sorcerer\'s Stone', [3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842], [3812]), ] tests_passed = True for clarification, candidates, expected_output in test_cases: if not assertListEquals( chatbot.disambiguate(clarification, candidates), expected_output, "Incorrect output for disambiguate('{}', {})".format( clarification, candidates), orderMatters=False): tests_passed = False if tests_passed: print('disambiguate() sanity check passed!') print() return True
def test_disambiguate(): print("Testing disambiguate() functionality...") chatbot = Chatbot(True) clarification = "1997" candidates = [1359, 2716] if assertListEquals(chatbot.disambiguate(clarification, candidates), [1359], "Incorrect output for disambiguate('{}', {})".format( clarification, candidates), orderMatters=False): print('disambiguate() sanity check passed!') print() return True
def test_disambiguate(): print("Testing disambiguate() functionality...") chatbot = Chatbot(True) if assertListEquals( chatbot.disambiguate("1997", [1359, 2716]), [1359], "Incorrect output for disambiguate('{}', {})".format( "1997", [1359, 2716]), orderMatters=False) and assertListEquals( chatbot.disambiguate("2", [1142, 1357, 2629, 546]), [1357], "Incorrect output for disambiguate('{}', {})".format( "2", [1142, 1357, 2629, 546]), orderMatters=False) and assertListEquals( chatbot.disambiguate("Sorcerer's Stone", [3812, 1267]), [3812], "Incorrect output for disambiguate('{}', {})".format( "Sorcerer's Stone", [3812, 1267]), orderMatters=False) and assertListEquals( chatbot.disambiguate("2", [8082, 4511, 1664]), [4511], "Incorrect output for disambiguate('{}', {})".format( "2", [8082, 4511, 1664]), orderMatters=False ) and assertListEquals( chatbot.disambiguate("most recent", [524, 5743]), [524], "Incorrect output for disambiguate('{}', {})".format( "most recent", [524, 5743]), orderMatters=False) and assertListEquals( chatbot.disambiguate("the Goblet of Fire one", [ 3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842 ]), [6294], "Incorrect output for disambiguate('{}', {})". format("the Goblet of Fire one", [ 3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842 ]), orderMatters=False) and assertListEquals( chatbot.disambiguate("the second one", [ 3812, 6294, 4325, 5399, 6735, 7274, 7670, 7842 ]), [6294], "Incorrect output for disambiguate('{}', {})". format("the second one", [ 3812, 6294, 4325, 5399, 6735, 7274, 7670, 7842 ]), orderMatters=False): print('disambiguate() sanity check passed!') print() return True