source: geniuswebcore/test/geniusweb/party/CapabilitiesTest.py@ 66

Last change on this file since 66 was 59, checked in by Wouter Pasman, 3 years ago

#44 manual commit of first public release, because this will cause the dist directory to move

File size: 1.4 KB
Line 
1import unittest
2
3from pyson.ObjectMapper import ObjectMapper
4
5from geniusweb.party.Capabilities import Capabilities
6
7
8class PartyTest(unittest.TestCase):
9 pyson = ObjectMapper()
10 cap= Capabilities( set([ "SAOP"]), set(['geniusweb.profile.utilityspace.LinearAdditive']))
11 cap1= Capabilities( set([ "SAOP"]), set(['geniusweb.profile.utilityspace.LinearAdditive']))
12 cap2= Capabilities( set([ "SHAOP"]), set(['geniusweb.profile.utilityspace.LinearAdditive']))
13 cap3= Capabilities( set([ "SAOP"]), set(['geniusweb.profile.Profile']))
14 capjson= {"behaviours":["SAOP"], "profiles":["geniusweb.profile.utilityspace.LinearAdditive"]}
15
16 def testSerialize(self):
17 print(str(self.pyson.toJson(self.cap)))
18 self.assertEqual(self.capjson, self.pyson.toJson(self.cap))
19
20 def testDeserialize(self):
21 self.assertEqual(self.cap, self.pyson.parse(self.capjson, Capabilities))
22
23 def testRepr(self):
24 self.assertEqual("Capabilities[{'geniusweb.profile.utilityspace.LinearAdditive'},{'SAOP'}]", repr(self.cap))
25
26 def testEqual(self):
27 self.assertEqual(self.cap, self.cap1)
28 self.assertNotEqual(self.cap, self.cap2)
29 self.assertNotEqual(self.cap, self.cap3)
30 self.assertEqual(hash(self.cap), hash(self.cap1))
31 self.assertNotEqual(hash(self.cap), hash(self.cap2))
32 self.assertNotEqual(hash(self.cap), hash(self.cap3))
33
Note: See TracBrowser for help on using the repository browser.