Beispiel #1
0
 def test_true_for_all_03(self):
     tree = ('<', ('>', 4, 3), ('>', ('>', 7, 5), 2))
     expect = False
     self.assertIs(quiz.true_for_all(tree), expect)
     tree = ('<', ('>', 4, 3), ('>', ('>', 7, 6), 5))
     expect = True
     self.assertIs(quiz.true_for_all(tree), expect)
Beispiel #2
0
 def test_true_for_all_02(self):
     tree = ('>', ('>', 10, 5), 6)
     expect = False
     self.assertIs(quiz.true_for_all(tree), expect)
     tree = ('<', 6, ('>', 10, 7))
     expect = True
     self.assertIs(quiz.true_for_all(tree), expect)
Beispiel #3
0
    def test_true_for_all_06(self):
        tree = make_tree('<', list(range(100)))
        expect = True
        self.assertIs(quiz.true_for_all(tree), expect)
        self.assertIs(quiz.true_for_all(('<', tree, 0)), False)

        tree = make_tree('>', list(range(500, -1, -1)))
        expect = True
        self.assertIs(quiz.true_for_all(tree), expect)
        self.assertIs(quiz.true_for_all(('>', tree, 0)), False)
Beispiel #4
0
 def test_true_for_all_01(self):
     simple_cases = [(('<', 1, 2), True), (('<', 1, 1), False),
                     (('<', 2, 1), False), (('>', 1, 2), False),
                     (('>', 2, 2), False), (('>', 3, 2), True)]
     for i in range(len(simple_cases)):
         with self.subTest(test=i):
             tree, expect = simple_cases[i]
             self.assertIs(quiz.true_for_all(tree), expect)
Beispiel #5
0
 def test_true_for_all_05(self):
     tree = ('<', ('>', 4, 1), ('<', 5, ('<', 7, 6)))
     expect = False
     self.assertIs(quiz.true_for_all(tree), expect)
Beispiel #6
0
 def test_true_for_all_04(self):
     tree = ('<', ('>', 4, 1), ('<', ('<', 2, 4), 5))
     expect = False
     self.assertIs(quiz.true_for_all(tree), expect)