source: geniuswebcore/test/geniusweb/issuevalue/DiscreteValueTest.py@ 62

Last change on this file since 62 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: 952 bytes
Line 
1import unittest
2
3from pyson.ObjectMapper import ObjectMapper
4
5from geniusweb.issuevalue.DiscreteValue import DiscreteValue
6from geniusweb.issuevalue.Value import Value
7
8
9class DiscreteValueTest(unittest.TestCase):
10 pyson=ObjectMapper()
11 val = DiscreteValue('val')
12 val1 = DiscreteValue('val')
13 val2 = DiscreteValue('val2')
14 valjson = 'val'
15
16 def testSerialize(self):
17 print(str(self.pyson.toJson(self.val)))
18 self.assertEqual(self.valjson, self.pyson.toJson(self.val))
19
20 def testDeserialize(self):
21 self.assertEqual(self.val, self.pyson.parse(self.valjson, Value))
22
23 def testRepr(self):
24 self.assertEqual('val', repr(self.val))
25
26 def testEqual(self):
27 self.assertEqual(self.val, self.val1)
28 self.assertNotEqual(self.val, self.val2)
29 self.assertEqual(hash(self.val), hash(self.val1))
30 self.assertNotEqual(hash(self.val), hash(self.val2))
31
Note: See TracBrowser for help on using the repository browser.