Last change
on this file since 78 was 73, checked in by Bart Vastenhouw, 3 years ago |
Fix for IssueValue hashcode.
|
File size:
1.0 KB
|
Line | |
---|
1 | from decimal import Decimal
|
---|
2 | import unittest
|
---|
3 |
|
---|
4 | from pyson.ObjectMapper import ObjectMapper
|
---|
5 |
|
---|
6 | from geniusweb.actions.Action import Action
|
---|
7 | from geniusweb.actions.EndNegotiation import EndNegotiation
|
---|
8 | from geniusweb.actions.PartyId import PartyId
|
---|
9 |
|
---|
10 |
|
---|
11 | class OfferTest (unittest.TestCase) :
|
---|
12 | actor=PartyId("myid")
|
---|
13 | actor2=PartyId("otherid")
|
---|
14 | endnego=EndNegotiation(actor)
|
---|
15 | endnego1=EndNegotiation(actor)
|
---|
16 | endnego2=EndNegotiation(actor2)
|
---|
17 |
|
---|
18 | pyson=ObjectMapper()
|
---|
19 |
|
---|
20 | def testSerialize(self):
|
---|
21 | self.assertEqual({'EndNegotiation': {'actor': 'myid'}}, self.pyson.toJson(self.endnego))
|
---|
22 |
|
---|
23 | def testDeserialize(self):
|
---|
24 | jsonenego= self.pyson.toJson(self.endnego)
|
---|
25 | self.assertEqual(self.endnego, self.pyson.parse(jsonenego, Action))
|
---|
26 |
|
---|
27 | def testRepr(self):
|
---|
28 | self.assertEqual("EndNegotiation[myid]", repr(self.endnego))
|
---|
29 |
|
---|
30 | def testEqual(self):
|
---|
31 | self.assertEqual(self.endnego, self.endnego1)
|
---|
32 | self.assertNotEqual(self.endnego, self.endnego2)
|
---|
33 | self.assertEqual(hash(self.endnego), hash(self.endnego1))
|
---|
34 | self.assertNotEqual(hash(self.endnego), hash(self.endnego2))
|
---|
35 | |
---|
Note:
See
TracBrowser
for help on using the repository browser.