class TestG2TetradAsia(unittest.TestCase):
    def setUp(self):
        self._asia_pdag = asia.adg().essential_graph()
        self._tetrad_pdag = Graph(vertices=self._asia_pdag.vertices()
                                 ,arrows=[('Tuberculosis','TbOrCa'),('Cancer','TbOrCa')]
                                 ,lines=[('Smoking','Cancer'),('Smoking','Bronchitis')
                                        ,('Bronchitis','Dyspnea')])

    def runTest(self):
        data = CompactFactor(read_csv(open('tetrad_asia.csv')),domain=Domain())
        ci = PCCI(G2Separator(data))
        g = ICPattern(ci)
        self.assertEquals(g.shd(self._asia_pdag),5)
        self.assertEquals(self._tetrad_pdag.shd(self._asia_pdag),4)
        # I think tetrad is wrong (in terms of implementation)
        self.assertEquals(g.shd(self._tetrad_pdag),1)
 def setUp(self):
     self._asia_pdag = asia.adg().essential_graph()
     self._tetrad_pdag = Graph(vertices=self._asia_pdag.vertices()
                              ,arrows=[('Tuberculosis','TbOrCa'),('Cancer','TbOrCa')]
                              ,lines=[('Smoking','Cancer'),('Smoking','Bronchitis')
                                     ,('Bronchitis','Dyspnea')])