示例#1
0
 def test_add_correct_example(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.confirm_implication(self.db.open_implications[0])
     imp = self.db.open_implications[0]
     intent = imp.premise | imp.conclusion
     self.db.add_example('test', intent)
     self.assertEqual(len(self.db._cxt.objects), 5)
示例#2
0
 def test_add_correct_example(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.confirm_implication(self.db.open_implications[0])
     imp = self.db.open_implications[0]
     intent = imp.premise | imp.conclusion
     self.db.add_example('test', intent)
     self.assertEqual(len(self.db._cxt.objects), 5)
示例#3
0
 def test_add_incorrect_example(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.confirm_implication(self.db.open_implications[0])
     imp = self.db.base[0]
     intent = imp.premise
     self.assertRaises(IllegalContextModification, self.db.add_example,
                       'test', intent)
     self.assertEqual(len(self.db._cxt.objects), 4)
示例#4
0
 def test_add_incorrect_example(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.confirm_implication(self.db.open_implications[0])
     imp = self.db.base[0]
     intent = imp.premise
     self.assertRaises(
         IllegalContextModification,
         self.db.add_example,
         'test', intent
     )
     self.assertEqual(len(self.db._cxt.objects), 4)
示例#5
0
 def test_all(self):
     basis = [
         Implication(set([acute, right]), set([equilateral, isosceles])),
         Implication(set([equilateral]), set([isosceles, acute]))
     ]
     expert = GenericExpert(basis)
     exploration = AttributeExploration(self.db, expert)
     expert.explore(exploration)
     self.assertEqual(len(self.db._cxt.objects), 6)
     self.assertEqual(len(self.db.base), len(basis))
示例#6
0
 def test_correct_implication_reject(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.reject_implication(self.db.open_implications[0])
     self.assertEqual(len(self.db._cxt.objects), 5)
示例#7
0
 def test_implication_confirm(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.confirm_implication(self.db.open_implications[0])
     self.assertEqual(len(self.db.base), 1)
     self.assertEqual(len(self.db.open_implications), 2)
示例#8
0
 def test_incorrect_implication_reject(self):
     expert = DummyFoolishExpert()
     exploration = AttributeExploration(self.db, expert)
     self.assertRaises(NotCounterexample, exploration.reject_implication,
                       self.db.open_implications[0])
     self.assertEqual(len(self.db._cxt.objects), 4)
示例#9
0
 def test_correct_implication_reject(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.reject_implication(self.db.open_implications[0])
     self.assertEqual(len(self.db._cxt.objects), 5)
示例#10
0
 def test_implication_confirm(self):
     expert = DummyPerfectExpert()
     exploration = AttributeExploration(self.db, expert)
     exploration.confirm_implication(self.db.open_implications[0])
     self.assertEqual(len(self.db.base), 1)
     self.assertEqual(len(self.db.open_implications), 2)
示例#11
0
 def test_with_foolish_expert(self):
     expert = DummyFoolishExpert()
     exploration = AttributeExploration(self.db, expert)
     self.assertEqual(len(self.db.open_implications), 3,
                      "Wrong number of attribute implications")