1 from teamwork.action.PsychActions import *
2 from teamwork.math.Keys import *
3
4 import unittest
5
8 self.action = Action({'actor':'Bill',
9 'type':'picksOn',
10 'object':'Victor'})
11
13 key = makeStateKey('actor','power')
14 self.assertEqual(str(key),"actor's power")
15 newKey = key.instantiate(self.action)
16 self.assert_(isinstance(newKey,list))
17 self.assertEqual(len(newKey),1)
18 newKey = newKey[0]
19 self.assertEqual(newKey.__class__,key.__class__)
20 self.assertEqual(str(newKey),"Bill's power")
21
28
30 key = RelationshipKey({'relater':'object',
31 'feature':'_likes',
32 'relatee':'actor'})
33 newKey = key.instantiate(self.action)
34 self.assert_(isinstance(newKey,list))
35 self.assertEqual(len(newKey),1)
36 newKey = newKey[0]
37 self.assertEqual(str(newKey),'Victor _likes Bill')
38
39 if __name__ == '__main__':
40 unittest.main()
41