コード例 #1
0
 def test_event_generate_periodic_target_single(self):
     """Do we get back the expected result when we have an EVENT?"""
     tf = Indicator.EVENT
     expected = {'period': self.event_name, 'period_name': self.event_name}
     result = generate_periodic_target_single(tf, self.start_date,
                                              0,
                                              event_name=self.event_name)
     self.assertEqual(expected, result)
コード例 #2
0
 def test_mid_generate_periodic_target_single(self):
     """Do we get back the expected result when we have an MID_END?"""
     tf = Indicator.MID_END
     expected = [{'period': 'Midline', 'period_name': u'Midline'}, {'period': 'Endline', 'period_name': u'Endline'}]
     result = generate_periodic_target_single(tf, self.start_date,
                                              self.nth_target_period,
                                              event_name=self.event_name)
     self.assertEqual(expected, result)
コード例 #3
0
 def test_lop_generate_periodic_target_single(self):
     """Do we get back the expected result when we have an LOP?"""
     tf = Indicator.LOP
     expected = {'period': "Life of Program (LoP) only", 'period_name': u'Life of Program (LoP) only'}
     result = generate_periodic_target_single(tf, self.start_date,
                                              self.nth_target_period,
                                              event_name=self.event_name)
     self.assertDictEqual(expected, result)
コード例 #4
0
    def test_annual(self):
        """Do we get back the correct period name back for ANNUAL frequency"""

        tf = Indicator.ANNUAL
        expected = {'period': 'Year 11', 'end_date': '2029-10-04',
                    'start_date': '2028-10-01',
                    'period_name': u'Year 11',}

        result = generate_periodic_target_single(tf, self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
コード例 #5
0
    def test_quarterly(self):
        """Do we get the correct period name back for QUARTERLY frequency"""

        tf = Indicator.QUARTERLY
        expected = {'end_date': '2021-07-04',
                    'period': 'Quarter 11',
                    'start_date': '2021-04-01',
                    'period_name': u'Quarter 11',}

        result = generate_periodic_target_single(tf, self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
コード例 #6
0
    def test_tri_annual(self):
        """Do we get the correct period name back for TRI_ANNUAL frequency"""

        tf = Indicator.TRI_ANNUAL
        expected = {'end_date': '2022-06-04',
                    'period': 'Tri-annual period 11',
                    'start_date': '2022-02-01',
                    'period_name': u'Tri-annual period 11',}

        result = generate_periodic_target_single(tf, self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
コード例 #7
0
    def test_monthly(self):
        """Do we get the correct period name back for MONTHLY frequency"""

        tf = Indicator.MONTHLY
        expected = {'end_date': '2019-09-04',
                    'period': 'August 2019',
                    'start_date': '2019-08-01',
                    'period_name': u'August 2019',}

        result = generate_periodic_target_single(tf, self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)