예제 #1
0
def test_find_movies_by_title():
    print("Testing find_movies_by_title() functionality...")
    chatbot = Chatbot(False)

    # add more test cases here!!!
    test_cases = [
        ('The American President', [10]),
        ('Titanic', [1359, 2716]),
        ('Titanic (1997)', [1359]),
        ('An American in Paris (1951)', [721]),
        ('The Notebook (1220)', []),
        ('Scream', [1142]),
    ]

    tests_passed = True
    for input_text, expected_output in test_cases:
        if not assert_list_equals(
                chatbot.find_movies_by_title(input_text),
                expected_output,
                "Incorrect output for find_movies_by_title('{}').".format(
                    input_text),
                orderMatters=False
        ):
            tests_passed = False
    if tests_passed:
        print('find_movies_by_title() sanity check passed!')
    print()
예제 #2
0
def test_find_movies_by_title():
    print("Testing find_movies_by_title() functionality...")
    chatbot = Chatbot(False)
    if assertListEquals(
            chatbot.find_movies_by_title("The American President"),
        [
            10
        ], "Incorrect output for find_movies_by_title('The American President')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("Titanic"), [1359, 2716],
            "Incorrect output for find_movies_by_title('Titanic').",
            orderMatters=False) and assertListEquals(
                chatbot.find_movies_by_title("Titanic (1997)"),
                [1359],
                "Incorrect output for find_movies_by_title('Titanic (1997)').",
            ):
        print('find_movies_by_title() sanity check passed!')
    print()
예제 #3
0
def test_find_movies_by_title():
    print("Testing find_movies_by_title() functionality...")
    chatbot = Chatbot(False)
    if assertListEquals(
            chatbot.find_movies_by_title("The American President"),
        [
            10
        ], "Incorrect output for find_movies_by_title('The American President')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("An American in Paris (1951)"),
        [
            721
        ], "Incorrect output for find_movies_by_title('An American in Paris (1951)')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("Titanic"), [1359, 2716],
            "Incorrect output for find_movies_by_title('Titanic').",
            orderMatters=False
    ) and assertListEquals(
            chatbot.find_movies_by_title("The Notebook"), [5448],
            "Incorrect output for find_movies_by_title('The Notebook')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("Titanic (1997)"),
        [1359],
            "Incorrect output for find_movies_by_title('Titanic (1997)').",
    ) and assertListEquals(
            chatbot.find_movies_by_title("There is no title here!"), [],
            "Incorrect output for find_movies_by_title('There is no title here!')."
    ):
        print('find_movies_by_title() sanity check passed!')
    print()
예제 #4
0
def test_find_movies_by_title_creative():
    print("Testing [CREATIVE MODE] find_movies_by_title() functionality...")
    chatbot = Chatbot(True)
    if assertListEquals(
            chatbot.find_movies_by_title("10 things i HATE about you"),
        [
            2063
        ], "Incorrect output for [CREATIVE] find_movies_by_title('10 things i HATE about you')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("There is no title here!"), [],
            "Incorrect output for [CREATIVE] find_movies_by_title('There is no title here!')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("Se7en"), [45],
            "Incorrect output for [CREATIVE] find_movies_by_title('Se7en')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("La guerre du feu"),
        [
            2439
        ], "Incorrect output for [CREATIVE] find_movies_by_title('La guerre du feu')."
    ) and assertListEquals(
            chatbot.find_movies_by_title(
                "The Tragedy of Othello: the moor of Venice"),
        [
            2279
        ], "Incorrect output for [CREATIVE] find_movies_by_title('Tragedy of Othello: The Moor of Venice, The')."
    ) and assertListEquals(
            chatbot.find_movies_by_title("Scream"), [546, 2629, 1357, 1142],
            "Incorrect output for [CREATIVE] find_movies_by_title('Scream').",
            orderMatters=False
    ) and assertListEquals(
            chatbot.find_movies_by_title("Percy Jackson"), [8377, 7463],
            "Incorrect output for [CREATIVE] find_movies_by_title('Percy Jackson').",
            orderMatters=False
    ) and assertListEquals(
            chatbot.find_movies_by_title("Harry potter"),
        [3812, 4325, 5399, 6294, 6735, 7274, 7670, 7842],
            "Incorrect output for [CREATIVE] find_movies_by_title('Harry potter').",
            orderMatters=False):
        print('[CREATIVE MODE] find_movies_by_title sanity check passed!')
    print()
예제 #5
0
def test_find_movies_by_title_creative():
    print("Testing find_movies_by_title_creative() functionality...")
    chatbot = Chatbot(True)

    # add more test cases here!!!
    test_cases = [
        ('10 things i HATE about you', [2063]),
        ('Se7en', [45]),
        ('La Guerre du feu', [2439]),
        ('Scream', [546, 1142, 1357, 2629]),
        ('Percy Jackson', [7463, 8377]),
    ]

    tests_passed = True
    for input_text, expected_output in test_cases:
        if not assertListEquals(
            chatbot.find_movies_by_title(chatbot.preprocess(input_text)),
            expected_output,
            "Incorrect output for find_movies_by_title(chatbot.preprocess('{}')).".format(input_text)
        ):
            tests_passed = False
    if tests_passed:
        print('find_movies_by_title_creative() sanity check passed!')
    print()
예제 #6
0
def test_find_movies_by_title_creative():
    print("Testing find_movies_by_title() functionality...")
    chatbot = Chatbot(True)

    if assertListEquals(
        chatbot.find_movies_by_title("The American President"),
        [10],
        "Incorrect output for find_movies_by_title('The American President')."
    ) and assertListEquals(
        chatbot.find_movies_by_title("The AMERICAN President"),
        [10],
        "Incorrect output for find_movies_by_title('The AMERICAN President')."
    ) and assertListEquals(
        chatbot.find_movies_by_title("Titanic"),
        [1359, 2716],
        "Incorrect output for find_movies_by_title('Titanic').",
        orderMatters=False
    ) and assertListEquals(
        chatbot.find_movies_by_title("Titanic (1997)"),
        [1359],
        "Incorrect output for find_movies_by_title('Titanic (1997)').",
    ) and assertListEquals(
        chatbot.find_movies_by_title("Business of"),
        [6924, 3849],
        "Incorrect output for find_movies_by_title('Business of')",
        orderMatters=False
    ) and assertListEquals(
        chatbot.find_movies_by_title("SCREAM"),
        [1142, 1357, 2629, 546],
        "Incorrect output for find_movies_by_title('SCREAM')",
        orderMatters=False
    ) and assertListEquals(
        chatbot.find_movies_by_title("Percy Jackson"),
        [7463, 8377],
        "Incorrect output for find_movies_by_title('Percy Jackson')",
        orderMatters=False
    ) and assertListEquals(
        chatbot.find_movies_by_title("Huang gu shi jie"),
        [792],
        "Incorrect output for find_movies_by_title('Huang gu shi jie')",
        orderMatters=False
    ) and assertListEquals(
        chatbot.find_movies_by_title("Gojira"),
        [1873, 1874, 1875, 3090, 4244, 6070],
        "Incorrect output for find_movies_by_title('Gojira')",
        orderMatters=False
    ) and assertListEquals(
        chatbot.find_movies_by_title("Alive & Kicking"),
        [1306],
        "Incorrect output for find_movies_by_title('Alive & Kicking')",
        orderMatters=False
    )  and assertListEquals(
        chatbot.find_movies_by_title("Las Vampiras"),
        [2585],
        "Incorrect output for find_movies_by_title('Las Vampiras')",
        orderMatters=False
    )  and assertListEquals(
        chatbot.find_movies_by_title("Phantom Love"),
        [2845],
        "Incorrect output for find_movies_by_title('Phantom Love')",
        orderMatters=False
    ):
        print('find_movies_by_title() sanity check passed!')
    print()