source: geniuswebcore/test/geniusweb/references/ProfileRefTest.py@ 75

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

Fix for IssueValue hashcode.

File size: 960 bytes
Line 
1import unittest
2
3from pyson.ObjectMapper import ObjectMapper
4from uri.uri import URI #type:ignore
5from geniusweb.references.ProfileRef import ProfileRef
6
7
8class ProfileRefTest (unittest.TestCase) :
9 pyson=ObjectMapper()
10
11
12 #NOTICE #38. We work around it here
13 ref=ProfileRef(URI("http://local/"))
14 ref1=ProfileRef(URI("http://local/"))
15 ref2=ProfileRef(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, ProfileRef))
26
27 def testRepr(self):
28 self.assertEqual("ProfileRef[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.