Last change
on this file since 82 was 81, checked in by Bart Vastenhouw, 3 years ago |
Added python timedependent parties (conceder, hardliner, etc)
|
File size:
968 bytes
|
Line | |
---|
1 | import unittest
|
---|
2 |
|
---|
3 | from pyson.ObjectMapper import ObjectMapper
|
---|
4 | from uri.uri import URI #type:ignore
|
---|
5 | from geniusweb.references.ProtocolRef import ProtocolRef
|
---|
6 |
|
---|
7 |
|
---|
8 | class ProtocolRefTest (unittest.TestCase) :
|
---|
9 | pyson=ObjectMapper()
|
---|
10 |
|
---|
11 |
|
---|
12 | #NOTICE #38. We work around it here
|
---|
13 | ref=ProtocolRef(URI("http://local/"))
|
---|
14 | ref1=ProtocolRef(URI("http://local/"))
|
---|
15 | ref2=ProtocolRef(URI("http://host"))
|
---|
16 |
|
---|
17 | reftxt="http://local/"
|
---|
18 | refjson=reftxt
|
---|
19 |
|
---|
20 | def testSerialize(self):
|
---|
21 | print(str(self.pyson.toJson(self.ref)))
|
---|
22 | self.assertEqual(self.refjson, self.pyson.toJson(self.ref))
|
---|
23 |
|
---|
24 | def testDeserialize(self):
|
---|
25 | self.assertEqual(self.ref, self.pyson.parse(self.refjson, ProtocolRef))
|
---|
26 |
|
---|
27 | def testRepr(self):
|
---|
28 | self.assertEqual("ProtocolRef[http://local/]", repr(self.ref))
|
---|
29 |
|
---|
30 | def testEqual(self):
|
---|
31 | self.assertEqual(self.ref, self.ref1)
|
---|
32 | self.assertNotEqual(self.ref, self.ref2)
|
---|
33 | self.assertEqual(hash(self.ref), hash(self.ref1))
|
---|
34 | self.assertNotEqual(hash(self.ref), hash(self.ref2))
|
---|
35 |
|
---|
36 | |
---|
Note:
See
TracBrowser
for help on using the repository browser.