Last change
on this file since 63 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:
956 bytes
|
Line | |
---|
1 | import unittest
|
---|
2 |
|
---|
3 | from pyson.ObjectMapper import ObjectMapper
|
---|
4 | from uri import URI #type:ignore
|
---|
5 | from geniusweb.references.ProfileRef import ProfileRef
|
---|
6 |
|
---|
7 |
|
---|
8 | class 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.