Last change
on this file since 65 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:
1.0 KB
|
Line | |
---|
1 | import unittest
|
---|
2 |
|
---|
3 | from pyson.ObjectMapper import ObjectMapper
|
---|
4 |
|
---|
5 | from geniusweb.references.Parameters import Parameters
|
---|
6 |
|
---|
7 |
|
---|
8 | class ParametersTest (unittest.TestCase) :
|
---|
9 | pyson=ObjectMapper()
|
---|
10 | params=Parameters({'a':1})
|
---|
11 | params1=Parameters({'a':1})
|
---|
12 | params2=Parameters()
|
---|
13 |
|
---|
14 | paramsjson={'a':1}
|
---|
15 |
|
---|
16 | def testGet(self):
|
---|
17 | self.assertEqual({'a':1}, self.params.getParameters())
|
---|
18 |
|
---|
19 | def testSerialize(self):
|
---|
20 | print(str(self.pyson.toJson(self.params)))
|
---|
21 | self.assertEqual(self.paramsjson, self.pyson.toJson(self.params))
|
---|
22 |
|
---|
23 | def testDeserialize(self):
|
---|
24 | self.assertEqual(self.params, self.pyson.parse(self.paramsjson, Parameters))
|
---|
25 |
|
---|
26 | def testRepr(self):
|
---|
27 | self.assertEqual("{'a': 1}", repr(self.params))
|
---|
28 |
|
---|
29 | def testEqual(self):
|
---|
30 | self.assertEqual(self.params, self.params1)
|
---|
31 | self.assertNotEqual(self.params, self.params2)
|
---|
32 | self.assertEqual(hash(self.params), hash(self.params1))
|
---|
33 | self.assertNotEqual(hash(self.params), hash(self.params2))
|
---|
34 |
|
---|
35 |
|
---|
36 | def testWith(self):
|
---|
37 | p=self.params.With('b', 2)
|
---|
38 | self.assertEqual({'a':1, 'b':2}, p.getParameters()) |
---|
Note:
See
TracBrowser
for help on using the repository browser.