本文整理汇总了Python中members.models.Member.add_n_months方法的典型用法代码示例。如果您正苦于以下问题:Python Member.add_n_months方法的具体用法?Python Member.add_n_months怎么用?Python Member.add_n_months使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类members.models.Member
的用法示例。
在下文中一共展示了Member.add_n_months方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_march30_minus_1
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_march30_minus_1(self):
# 1 month before March 30 is February 28
self.assertEqual(Member.add_n_months(date(2015, 3, 30), -1),
date(2015, 2, 28))
# or February 29
self.assertEqual(Member.add_n_months(date(2016, 3, 30), -1),
date(2016, 2, 29))
示例2: test_dec30_plus_2
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_dec30_plus_2(self):
# 2 months after December 30 is February 28
self.assertEqual(Member.add_n_months(date(2014, 12, 30), 2),
date(2015, 2, 28))
# or February 29
self.assertEqual(Member.add_n_months(date(2015, 12, 30), 2),
date(2016, 2, 29))
示例3: test_march1_minus_1
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_march1_minus_1(self):
# 1 month before March 1 is February 1
self.assertEqual(Member.add_n_months(date(2015, 3, 1), -1),
date(2015, 2, 1))
示例4: test_dec31_minus_1
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_dec31_minus_1(self):
# 1 month before December 31 is November 30
self.assertEqual(Member.add_n_months(date(2015, 12, 31), -1),
date(2015, 11, 30))
示例5: test_jan1_minus_1
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_jan1_minus_1(self):
# 1 month before January 1 is December 1
self.assertEqual(Member.add_n_months(date(2015, 1, 1), -1),
date(2014, 12, 1))
示例6: test_jan1_plus_12
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_jan1_plus_12(self):
# 12 months after January 1 is January 1 next year
self.assertEqual(Member.add_n_months(date(2015, 1, 1), 12),
date(2016, 1, 1))
示例7: test_dec1_plus_2
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_dec1_plus_2(self):
# 2 months after December 1 is February 1
self.assertEqual(Member.add_n_months(date(2014, 12, 1), 2),
date(2015, 2, 1))
示例8: test_jan1_plus_2
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_jan1_plus_2(self):
# 2 months after January 1 is March 1
self.assertEqual(Member.add_n_months(date(2015, 1, 1), 2),
date(2015, 3, 1))
示例9: test_jan30_plus_1
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_jan30_plus_1(self):
# 1 month after January 30 is February 28
self.assertEqual(Member.add_n_months(date(2015, 1, 30), 1),
date(2015, 2, 28))
示例10: test_jan1_plus_1
# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import add_n_months [as 别名]
def test_jan1_plus_1(self):
# 1 month after January 1 is February 1
self.assertEqual(Member.add_n_months(date(2015, 1, 1), 1),
date(2015, 2, 1))