def test_valid_format(self): ld = LunarDate(2018, 4, 3) self.assertEqual('2018-4-3', ld.strftime('%y-%m-%d')) self.assertEqual('二〇一八', ld.strftime('%Y')) self.assertEqual('2018%c', ld.strftime('%y%c')) # Just ignore %c, no raise error ld2 = LunarDate(2018, 11, 23) self.assertEqual('二〇一八/冬/廿三', ld2.strftime('%Y/%M/%D')) ld3 = LunarDate(2017, 6, 3, 1) self.assertEqual('61', ld3.strftime('%m%l')) self.assertEqual('闰六', ld3.strftime('%L%M')) self.assertEqual(ld3.gz_str(), ld3.strftime('%G')) self.assertEqual('%y', ld3.strftime('%%y')) self.assertEqual('%2017', ld3.strftime('%%%y')) self.assertEqual('2017631', ld3.strftime('%y%m%d%l')) self.assertEqual('201706031', ld3.strftime('%y%A%B%l'))
def test_cn_calendar_day(self): ld = LunarDate(2017, 6, 1, 1) self.assertEqual('闰六', ld.strftime('%F')) ld1 = LunarDate(2017, 11, 1, 0) self.assertEqual('冬月', ld1.strftime('%F'))
def test_term(self): ld = LunarDate(2020, 3, 23) self.assertEqual('tem:-', ld.strftime('tem:%t'))