コード例 #1
0
 def check_instance(self, actual_code, correct_code, msg=None):
     """Checks if ACTUAL_CODE is an instance of CORRECT_CODE."""
     return self.check_equal(
         actual_code,
         correct_code,
         msg=msg,
         equal=lambda x, y: unify.instance(x, y) is not None)
コード例 #2
0
ファイル: test_unify.py プロジェクト: jrosenbl/congress
    def test_instance(self):
        """Test whether the INSTANCE computation is correct."""
        def assertIsNotNone(x):
            self.assertTrue(x is not None)

        def assertIsNone(x):
            self.assertTrue(x is None)

        assertIsNotNone(unify.instance(str2form('p(1)'), str2form('p(y)')))
        assertIsNotNone(unify.instance(str2form('p(1,2)'), str2form('p(x,y)')))
        assertIsNotNone(unify.instance(str2form('p(1,x)'), str2form('p(x,y)')))
        assertIsNotNone(unify.instance(str2form('p(1,x,1)'),
                        str2form('p(x,y,x)')))
        assertIsNotNone(unify.instance(str2form('p(1,x,1)'),
                        str2form('p(x,y,z)')))
        assertIsNone(unify.instance(str2form('p(1,2)'), str2form('p(x,x)')))
コード例 #3
0
    def test_instance(self):
        """Test whether the INSTANCE computation is correct."""
        def assertIsNotNone(x):
            self.assertTrue(x is not None)

        def assertIsNone(x):
            self.assertTrue(x is None)

        assertIsNotNone(unify.instance(str2form('p(1)'), str2form('p(y)')))
        assertIsNotNone(unify.instance(str2form('p(1,2)'), str2form('p(x,y)')))
        assertIsNotNone(unify.instance(str2form('p(1,x)'), str2form('p(x,y)')))
        assertIsNotNone(
            unify.instance(str2form('p(1,x,1)'), str2form('p(x,y,x)')))
        assertIsNotNone(
            unify.instance(str2form('p(1,x,1)'), str2form('p(x,y,z)')))
        assertIsNone(unify.instance(str2form('p(1,2)'), str2form('p(x,x)')))
コード例 #4
0
 def check_instance(self, actual_code, correct_code, msg=None):
     """Checks if ACTUAL_CODE is an instance of CORRECT_CODE."""
     return self.check_equal(
         actual_code, correct_code, msg=msg,
         equal=lambda x, y: unify.instance(x, y) is not None)