コード例 #1
0
ファイル: sanitycheck.py プロジェクト: antonioferris/goosenet
def test_find_movies_closest_to_title():
    print("Testing find_movies_closest_to_title() functionality...")
    chatbot = Chatbot(True)

    misspelled = "Sleeping Beaty"

    if assertListEquals(
            chatbot.find_movies_closest_to_title(misspelled,
                                                 max_distance=3), [1656],
            "Incorrect output for test_find_movies_closest_to_title('{}', max_distance={})"
            .format(misspelled, 3),
            orderMatters=False
    ) and assertListEquals(
            chatbot.find_movies_closest_to_title(
                "Te", max_distance=3), [8082, 4511, 1664],
            "Incorrect output for test_find_movies_closest_to_title('{}', max_distance={})"
            .format("Te", 3),
            orderMatters=False
    ) and assertListEquals(
            chatbot.find_movies_closest_to_title("BAT-MAAAN",
                                                 max_distance=3), [524, 5743],
            "Incorrect output for test_find_movies_closest_to_title('{}', max_distance={})"
            .format("BAT-MAAAN", 3),
            orderMatters=False
    ) and assertListEquals(
            chatbot.find_movies_closest_to_title("Blargdeblargh",
                                                 max_distance=4), [],
            "Incorrect output for test_find_movies_closest_to_title('{}', max_distance={})"
            .format("Blargdeblargh", 4),
            orderMatters=False):
        print('find_movies_closest_to_title() sanity check passed!')
    print()
    return True
コード例 #2
0
def test_find_movies_closest_to_title():
    print("Testing find_movies_closest_to_title() functionality...")
    chatbot = Chatbot(True)

    # add more test cases here!!!
    test_cases = [
        ('Sleeping Beaty', [1656]),
        ('Te', [8082, 4511, 1664]),
        ('BAT-MAAAN', [524, 5743]),
        ('Blargdeblargh', []),
    ]

    tests_passed = True
    for input_text, expected_output in test_cases:
        if not assertListEquals(
                chatbot.find_movies_closest_to_title(
                    chatbot.preprocess(input_text)),
                expected_output,
                "Incorrect output for find_movies_closest_to_title(chatbot.preprocess('{}'))."
                .format(input_text),
                orderMatters=False):
            tests_passed = False
    if tests_passed:
        print('find_movies_closest_to_title() sanity check passed!')
    print()
    return True
コード例 #3
0
def test_find_movies_closest_to_title():
    print("Testing find_movies_closest_to_title() functionality...")
    chatbot = Chatbot(True)

    # add more test cases here!!!
    test_cases = [('Sleeping Beaty', [1656]), ('Te', [8082, 4511, 1664]),
                  ('BAT-MAAAN', [524, 5743]), ('Blargdeblargh', []),
                  ('The Notebok', [5448]),
                  ('An Awfully Big Advventuree', [127]),
                  ('An Amrican in Paris', [721]),
                  ('The Cellloid Closet', [516]), ('Titanc', [2716, 1359])]

    tests_passed = True
    for input_text, expected_output in test_cases:
        if not assert_list_equals(
                chatbot.find_movies_closest_to_title(input_text),
                expected_output,
                "Incorrect output for find_movies_closest_to_title("
                "chatbot.preprocess('{}')).".format(input_text),
                orderMatters=False):
            tests_passed = False
    if tests_passed:
        print('find_movies_closest_to_title() sanity check passed!')
    print()
    return True
コード例 #4
0
def test_find_movies_closest_to_title():
    print("Testing find_movies_closest_to_title() functionality...")
    chatbot = Chatbot(True)

    misspelled = "Sleeping Beaty"
    if assertListEquals(
        chatbot.find_movies_closest_to_title(misspelled, max_distance=3),
        [1656],
        "Incorrect output for test_find_movies_closest_to_title('{}', max_distance={})".format(misspelled, 3),
        orderMatters=False
    ):
        print('find_movies_closest_to_title() sanity check passed!')
    print()
    return True