def test_is_admissible(self): arg1 = MagicMock() arg1.is_acceptable.return_value = True arg2 = MagicMock() arg2.is_acceptable.return_value = True arg3 = MagicMock() arg3.is_acceptable.return_value = True arg4 = MagicMock() arg5 = MagicMock() rel14 = MagicMock() rel14.relfrom = arg1 rel14.relto = arg4 rel52 = MagicMock() rel52.relfrom = arg5 rel52.relto = arg2 rel54 = MagicMock() rel54.relfrom = arg5 rel54.relto = arg4 extension = Extension(arg1, arg4) self.assertFalse(extension.is_admissible([rel14])) extension = Extension(arg1, arg2, arg3) self.assertTrue(extension.is_admissible([rel14])) arg2.is_acceptable.return_value = False self.assertFalse(extension.is_admissible([rel14, rel52, rel54]))
def test_is_conflict_free(self): arg1 = MagicMock() arg2 = MagicMock() arg3 = MagicMock() arg4 = MagicMock() arg5 = MagicMock() rel14 = MagicMock() rel14.relfrom = arg1 rel14.relto = arg4 rel52 = MagicMock() rel52.relfrom = arg5 rel52.relto = arg2 rel54 = MagicMock() rel54.relfrom = arg5 rel54.relto = arg4 extension = Extension(arg1, arg2, arg3) self.assertTrue(extension.is_conflict_free([rel14, rel52, rel54]))
def test_is_conflicting(self): arg1 = MagicMock() arg2 = MagicMock() arg3 = MagicMock() rel12 = MagicMock() rel12.relfrom = arg1 rel12.relto = arg2 extension = Extension(arg1, arg2, arg3) self.assertFalse(extension.is_conflict_free([rel12]))
def test_draw(self): graph = Graph() arg1 = MagicMock() arg1.id = "arg1" arg2 = MagicMock() arg2.id = "arg2" arg3 = MagicMock() arg3.id = "arg3" graph.add_arguments(arg1, arg2, arg3) rel1 = MagicMock() rel1.relfrom = arg1 rel1.relto = arg2 rel1.type = RelationType.support rel2 = MagicMock() rel2.relfrom = arg1 rel2.relto = arg3 rel2.type = RelationType.objection graph.add_relations(rel1, rel2) graph.draw('png', 'test')
def test_is_stable(self): arg1 = MagicMock() arg2 = MagicMock() arg3 = MagicMock() arg4 = MagicMock() rel = MagicMock() rel.relfrom = arg1 rel.relto = arg4 extension = Extension(arg1, arg2, arg3) self.assertTrue(extension.is_stable([arg1, arg2, arg3, arg4], [rel])) arg5 = MagicMock() self.assertFalse(extension.is_stable([arg1, arg2, arg3, arg4, arg5], [rel])) rel2 = MagicMock() rel2.relfrom = arg1 rel2.relto = arg2 self.assertFalse(extension.is_stable([arg1, arg2, arg3, arg4], [rel, rel2])) rel3 = MagicMock() rel3.relfrom = arg4 rel3.relto = arg1 self.assertTrue(extension.is_stable([arg1, arg2, arg3, arg4], [rel, rel3]))
def test_is_acceptable(self): premise = Premise(1) arg1 = MagicMock() arg2 = MagicMock() arg3 = MagicMock() rel = MagicMock() rel.relfrom = arg1 rel.relto = premise extension = MagicMock() extension.arguments = [arg2] self.assertTrue(premise.is_acceptable(extension, [])) self.assertFalse(premise.is_acceptable(extension, [rel])) rel2 = MagicMock() rel2.relfrom = arg2 rel2.relto = arg1 self.assertTrue(premise.is_acceptable(extension, [rel, rel2])) rel3 = MagicMock() rel3.relfrom = arg3 rel3.relto = arg1 self.assertFalse(premise.is_acceptable(extension, [rel, rel3]))