示例#1
0
    def test_num_months_difference_two_years(self):
        date1 = datetime.date(2022, 1, 18)
        date2 = datetime.date(2020, 1, 18)

        difference = utils.num_months_difference(date1, date2)

        self.assertEqual(difference, 24)
示例#2
0
    def test_num_months_difference_same_month(self):
        date1 = datetime.date(2020, 1, 31)
        date2 = datetime.date(2020, 1, 1)

        difference = utils.num_months_difference(date1, date2)

        self.assertEqual(difference, 0)
示例#3
0
    def test_num_months_difference_one_week(self):
        date1 = datetime.date(2020, 2, 5)
        date2 = datetime.date(2020, 1, 28)

        difference = utils.num_months_difference(date1, date2)

        self.assertEqual(difference, 0)