source: geniuswebcore/test/geniusweb/deadline/DeadlineRoundsTest.py@ 66

Last change on this file since 66 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.4 KB
Line 
1
2from datetime import datetime
3import unittest
4
5from pyson.ObjectMapper import ObjectMapper
6
7from geniusweb.deadline.Deadline import Deadline
8from geniusweb.deadline.DeadlineRounds import DeadlineRounds
9
10
11class DeadlineRoundsTest(unittest.TestCase):
12 pyson=ObjectMapper()
13 deadline = DeadlineRounds(10,1999)
14 deadline1 = DeadlineRounds(10,1999)
15 deadline2 = DeadlineRounds(10,4328)
16 deadline3 = DeadlineRounds(9,1999)
17 deadlinejson = {"DeadlineRounds":{'rounds':10, "durationms":1999}}
18
19 def testDeserialization(self):
20 self.assertEqual(self.deadline, self.pyson.parse(self.deadlinejson, Deadline))
21
22 def testSerialization(self):
23 print(self.pyson.toJson(self.deadline))
24 self.assertEqual(self.deadlinejson, self.pyson.toJson(self.deadline))
25
26 def testRepr(self):
27 self.assertEqual("DeadlineRounds[10,1999]", repr(self.deadline))
28
29 def testEqual(self):
30 self.assertEqual(self.deadline, self.deadline1)
31 self.assertNotEqual(self.deadline, self.deadline2)
32 self.assertNotEqual(self.deadline, self.deadline3)
33 self.assertEqual(hash(self.deadline), hash(self.deadline1))
34 self.assertNotEqual(hash(self.deadline), hash(self.deadline2))
35 self.assertNotEqual(hash(self.deadline), hash(self.deadline3))
36
37 def testGetDuration(self):
38 self.assertEqual(1999, self.deadline.getDuration())
Note: See TracBrowser for help on using the repository browser.