Exemplo n.º 1
0
 def test_threaded(self):
     """push default atomspace in different thread and check the behaviour"""
     test_as = AtomSpace()
     different_as = AtomSpace()
     push_default_atomspace(test_as)
     th = threading.Thread(target=push_default, args=(different_as,))
     th.start()
     th.join()
     # ConceptNode('test-1') should only be in different_as
     # ConceptNode('test-2') should only be in test_as
     # if thread-local storage works as expected
     ConceptNode("test-2")
     self.assertTrue(different_as.is_node_in_atomspace(types.ConceptNode, "test-1"))
     self.assertFalse(different_as.is_node_in_atomspace(types.ConceptNode, "test-2"))
Exemplo n.º 2
0
def push_default(atomspace):
    push_default_atomspace(atomspace)
    ConceptNode("test-1")
Exemplo n.º 3
0
 def setUp(self):
     self.space = AtomSpace()
     push_default_atomspace(self.space)