Exemple #1
0
    def test_identify_eds_not_adjacent(self):
        """_identify_eds_ing raises a ValueError if the edges are not adjacent."""
        # Setup
        first = Edge(None, 0, 1, None, None)
        second = Edge(None, 2, 3, None, None)

        # Please, note that we passed the index, copula_name and copula_theta as None
        # To show they are no going to be used in the scope of this test.

        # Run / Check
        # As they are not adjacent, we can asure calling _identify_eds_ing will raise a ValueError.
        assert not first.is_adjacent(second)

        with self.assertRaises(ValueError):
            Edge._identify_eds_ing(first, second)
Exemple #2
0
    def test_identify_eds_empty_dependence(self):
        """_identify_eds_ing don't require edges to have dependence set."""
        # Setup
        first = Edge(None, 0, 1, None, None)
        second = Edge(None, 1, 2, None, None)

        # Please, note that we passed the index, copula_name and copula_theta as None
        # To show they are no going to be used in the scope of this test.

        # left, right and dependence set
        expected_result = (0, 2, {1})

        # Run
        result = Edge._identify_eds_ing(first, second)

        # Check
        assert result == expected_result
Exemple #3
0
    def test_identify_eds(self):
        """_identify_eds_ing returns the left, right and dependency for a new edge."""
        # Setup
        first = Edge(None, 2, 5, None, None)
        first.D = {1, 3}

        second = Edge(None, 3, 4, None, None)
        second.D = {1, 5}

        # Please, note that we passed the index, copula_name and copula_theta as None
        # To show they are no going to be used in the scope of this test.

        # left, right and dependence set
        expected_result = (2, 4, set([1, 3, 5]))

        # Run
        result = Edge._identify_eds_ing(first, second)

        # Check
        assert result == expected_result
Exemple #4
0
 def test_identify_eds(self):
     left, right, depend_set = Edge._identify_eds_ing(self.e1, self.e2)
     assert left == 2
     assert right == 4
     expected_result = set([1, 3, 5])
     assert depend_set == expected_result