示例#1
0
def tmp_atomspace(atomspace):
    parent_atomspace = atomspace
    atomspace = create_child_atomspace(parent_atomspace)
    initialize_opencog(atomspace)
    try:
        yield atomspace
    finally:
        atomspace.clear()
        finalize_opencog()
        initialize_opencog(parent_atomspace)
示例#2
0
 def tearDown(self):
     finalize_opencog()
     del self.space
示例#3
0
result = bindlink(atomspace, bindlink_handle)
assert_true(result is not None and result.value() > 0)

# Check the ending atomspace size, it should have added one SetLink.
ending_size = atomspace.size()
assert_equals(ending_size, starting_size + 1)

# The SetLink should have three items in it.
atom = atomspace[result]
assert_equals(atom.arity, 3)
assert_equals(atom.type, types.SetLink)

result = execute_atom(atomspace, 
        ExecutionOutputLink( 
            GroundedSchemaNode("py: add_link"),
            ListLink(
                ConceptNode("one"),
                ConceptNode("two") 
            )
        )
    )
list_link = ListLink(
        ConceptNode("one"),
        ConceptNode("two")
    )
assert_equals(result, list_link)

finalize_opencog()
del atomspace

示例#4
0
assert_true(result is not None)

# Check the ending atomspace size, it should be the same.
ending_size = atomspace.size()
assert_equals(ending_size, starting_size)

# Remember the starting atomspace size.
starting_size = atomspace.size()

# Run bindlink.
result = bindlink(atomspace, bindlink_atom)
assert_true(result is not None)

# Check the ending atomspace size, it should have added one SetLink.
ending_size = atomspace.size()
assert_equals(ending_size, starting_size + 1)

# The SetLink should have three items in it.
assert_equals(result.arity, 3)
assert_equals(result.type, types.SetLink)

result = execute_atom(
    atomspace,
    ExecutionOutputLink(GroundedSchemaNode("py: add_link"),
                        ListLink(ConceptNode("one"), ConceptNode("two"))))
list_link = ListLink(ConceptNode("one"), ConceptNode("two"))
assert_equals(result, list_link)

finalize_opencog()
del atomspace
示例#5
0
 def tearDown(self):
     finalize_opencog()
     del self.space
示例#6
0
 def test_initialize_finalize(self):
     initialize_opencog(self.atomspace)
     finalize_opencog()
 def test_initialize_finalize(self):
     initialize_opencog(self.atomspace)
     finalize_opencog()
示例#8
0
 def remove(self):
     # make sure this is called by the time script exits
     finalize_opencog()
     del self.a
示例#9
0
 def tearDown(self):
     finalize_opencog()
示例#10
0
 def tearDownClass(cls):
     finalize_opencog()
     global atomspace
     del atomspace
示例#11
0
文件: test.py 项目: singnet/opencog
 def tearDown(self):
     self.atomspace = None
     finalize_opencog()
示例#12
0
def delete_child_atomspace():
    global child_atomspace
    child_atomspace.clear()
    finalize_opencog()
    initialize_opencog(atomspace)
 def delete_child_atomspace(self):
     self.child_atomspace.clear()
     finalize_opencog()
     initialize_opencog(self.atomspace)