source: geniuswebcore/test/geniusweb/actions/LearningDoneTest.py@ 65

Last change on this file since 65 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.1 KB
Line 
1from decimal import Decimal
2import unittest
3
4from pyson.ObjectMapper import ObjectMapper
5
6from geniusweb.actions.Action import Action
7from geniusweb.actions.LearningDone import LearningDone
8from geniusweb.actions.PartyId import PartyId
9
10
11class OfferTest (unittest.TestCase) :
12 actor=PartyId("myid")
13 actor2=PartyId("otherid")
14 learningdone=LearningDone(actor)
15 learningdone1=LearningDone(actor)
16 learningdone2=LearningDone(actor2)
17
18 pyson=ObjectMapper()
19
20 def testSerialize(self):
21 self.assertEqual({'LearningDone': {'actor': 'myid'}}, self.pyson.toJson(self.learningdone))
22
23 def testDeserialize(self):
24 jsonenego= self.pyson.toJson(self.learningdone)
25 self.assertEqual(self.learningdone, self.pyson.parse(jsonenego, Action))
26
27 def testRepr(self):
28 self.assertEqual("LearningDone[myid]", repr(self.learningdone))
29
30 def testEqual(self):
31 self.assertEqual(self.learningdone, self.learningdone1)
32 self.assertNotEqual(self.learningdone, self.learningdone2)
33 self.assertEqual(hash(self.learningdone), hash(self.learningdone1))
34 self.assertNotEqual(hash(self.learningdone), hash(self.learningdone2))
35
Note: See TracBrowser for help on using the repository browser.