Exemple #1
0
    def test_are_cousins_same_value(self):
        # arrange
        tree = create_tree_from_list([1, 2, 3, 4, None, 5, 6])

        # act
        result = are_cousins(tree, 2, 2)

        # assert
        self.assertFalse(result)
Exemple #2
0
    def test_are_cousins_true(self):
        # arrange
        tree = create_tree_from_list([1, 2, 3, 4, None, 5, None, 6, 7, 8, 9])

        # act
        result = are_cousins(tree, 6, 9)

        # assert
        self.assertTrue(result)
Exemple #3
0
    def test_are_cousins_same_parents(self):
        # arrange
        tree = create_tree_from_list([1, 2, 3])

        # act
        result = are_cousins(tree, 2, 3)

        # assert
        self.assertFalse(result)
Exemple #4
0
    def test_are_cousins_y_first(self):
        # arrange
        tree = create_tree_from_list([1, 2, 3, 4, None, None, 5])

        # act
        result = are_cousins(tree, 5, 2)

        # assert
        self.assertFalse(result)