コード例 #1
0
    def test_store_and_access(self):
        s = State()
        p = PredicateInstance('happy', Instance('a'))
        s.append(p)

        self.assertEqual([p], s.fetch('happy', [Instance('a')]))
        self.assertStateContains(PredicateInstance('happy', Instance('a')),
                                 Evaluator(state=s))
コード例 #2
0
 def test_store_multiple(self):
     s = State()
     s.append(PredicateInstance('happy', Instance('a')))
     s.append(PredicateInstance('unhappy', Instance('a')))
     self.assertStateContains(PredicateInstance('happy', Instance('a')),
                              Evaluator(state=s))
     self.assertStateContains(PredicateInstance('unhappy', Instance('a')),
                              Evaluator(state=s))