Exemplo n.º 1
0
                                   [make_review(name, 5)])

        a = make_testaurant('A', ['Creperies', 'Italian'])
        b = make_testaurant('B', ['Italian', 'Coffee & Tea'])
        c = make_testaurant('C', ['Coffee & Tea', 'Greek', 'Creperies'])
        d = make_testaurant('D', ['Greek'])
        try:
            self.assertTrue(
                test.check_same_elements(search('Creperies', [a, b, c, d]),
                                         [a, c]))
            self.assertTrue(
                test.check_same_elements(search('Thai', [a, b, c, d]), []))
            self.assertTrue(
                test.check_same_elements(search('Coffee & Tea', [a, b, d]),
                                         [b]))
            self.assertTrue(
                test.check_same_elements(search('Greek', [a, b, c, d]),
                                         [c, d]))
            self.assertTrue(
                test.check_same_elements(search('Italian', [a, b, c, d]),
                                         [a, b]))
        except AssertionError:
            print("Failed Abstraction Test")


if __name__ == '__main__':
    unittest.main()
    recommend.sample = old_sample
    test.restore_implementations(recommend)
    test.restore_implementations(abstractions)
                                   [make_review(name, 5)])

        a = make_testaurant('A', ['Creperies', 'Italian'])
        b = make_testaurant('B', ['Italian', 'Coffee & Tea'])
        c = make_testaurant('C', ['Coffee & Tea', 'Greek', 'Creperies'])
        d = make_testaurant('D', ['Greek'])
        try:
            self.assertTrue(
                test.check_same_elements(search('Creperies', [a, b, c, d]),
                                         [a, c]))
            self.assertTrue(
                test.check_same_elements(search('Thai', [a, b, c, d]), []))
            self.assertTrue(
                test.check_same_elements(search('Coffee & Tea', [a, b, d]),
                                         [b]))
            self.assertTrue(
                test.check_same_elements(search('Greek', [a, b, c, d]),
                                         [c, d]))
            self.assertTrue(
                test.check_same_elements(search('Italian', [a, b, c, d]),
                                         [a, b]))
        except AssertionError:
            print("Failed Abstraction Test")


if __name__ == '__main__':
    unittest.main()
    #recommend.sample = old_sample
    #test.restore_implementations(recommend)
    test.restore_implementations(abstractions)