Ejemplo n.º 1
0
class TestDateHelper(unittest.TestCase):
    def setUp(self):
        self.dh = DateHelper()
        self.date_str = "1999-08-01"
        self.datetime_str = "1998-05-02 14:08:00"
        self.date_obj = self.dh.make_date(self.date_str)
        self.datetime_obj = self.dh.make_datetime(self.datetime_str)

    def test_print_date(self):
        expected = "01 Aug 1999"
        actual = self.dh.print_date(self.date_obj)
        self.assertEqual(expected, actual)

    def test_print_datetime(self):
        expected = "14:08:00 02 May 1998"
        actual = self.dh.print_datetime(self.datetime_obj)
        self.assertEqual(expected, actual)

    def test_print_nice(self):
        expected = "2:08pm, 2 May 1998"
        actual = self.dh.print_nice(self.datetime_obj)
        self.assertEqual(expected, actual)
Ejemplo n.º 2
0
 def print_recovery(self):
     dh = DateHelper()
     recovery_time = self.start + self.duration + self.recovery
     return dh.print_nice(recovery_time)
Ejemplo n.º 3
0
 def print_duration(self):
     dh = DateHelper()
     treatment_time = self.start + self.duration
     return dh.print_nice(treatment_time)
Ejemplo n.º 4
0
 def print_start(self):
     dh = DateHelper()
     start_time = dh.print_nice(self.start)
     return start_time