source: geniuswebcore/test/geniusweb/references/ProtocolRefTest.py@ 84

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

Added time-dependent parties for python and simpleRunner-GUI for java

File size: 968 bytes
Line 
1import unittest
2
3from pyson.ObjectMapper import ObjectMapper
4from uri.uri import URI #type:ignore
5from geniusweb.references.ProtocolRef import ProtocolRef
6
7
8class 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.