source: geniuswebcore/test/geniusweb/inform/ActionDoneTest.py@ 69

Last change on this file since 69 was 67, checked in by Bart Vastenhouw, 3 years ago

Added SAOP and simplerunner to GeniusWebPython. Several minor fixes.

File size: 1.6 KB
Line 
1import unittest
2
3from pyson.ObjectMapper import ObjectMapper
4
5from geniusweb.actions.EndNegotiation import EndNegotiation
6from geniusweb.actions.PartyId import PartyId
7from geniusweb.inform.ActionDone import ActionDone
8from geniusweb.inform.Inform import Inform
9from geniusweb.inform.YourTurn import YourTurn
10from geniusweb.inform.Voting import Voting
11from unitpy.GeneralTests import GeneralTests
12
13
14class ActionDoneTest(unittest.TestCase):
15
16 pyson=ObjectMapper()
17 pid1=PartyId("party1")
18 pid2=PartyId("party2")
19
20 endnego=EndNegotiation(pid1)
21 endnego1=EndNegotiation(pid1)
22 endnego2=EndNegotiation(pid2)
23
24 actiondone=ActionDone(endnego)
25 actiondone1=ActionDone(endnego1)
26 actiondone2=ActionDone(endnego2)
27
28 actiondonejson = {"ActionDone":{"action":{"EndNegotiation":{"actor":"party1"}}}}
29
30 def testSerializeDeserialize(self):
31
32 print(str(self.pyson.toJson(self.actiondone)))
33 self.assertEqual(self.actiondonejson, self.pyson.toJson(self.actiondone))
34
35 def testDeserialize(self):
36 self.assertEqual(self.actiondone, self.pyson.parse(self.actiondonejson, Inform))
37
38
39 def testRepr(self):
40 self.assertEqual("ActionDone[EndNegotiation[party1]]", repr(self.actiondone))
41
42 def testEqual(self):
43 self.assertEqual(self.actiondone, self.actiondone1)
44 self.assertNotEqual(self.actiondone, self.actiondone2)
45 self.assertEqual(hash(self.actiondone), hash(self.actiondone1))
46 self.assertNotEqual(hash(self.actiondone), hash(self.actiondone2))
47
48
Note: See TracBrowser for help on using the repository browser.