test_netcdftime.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:netcdftime 作者: Unidata 项目源码 文件源码
def test_dayofwk(self):
        "Test computation of dayofwk in the 365_day calendar."

        converter = self.converters["noleap"]

        # Pick the date corresponding to the Julian day of 1.0 to test
        # the transision from positive to negative Julian days.
        julian_day = converter.date2num(datetimex(-4712, 1, 2, 12))

        old_date = converter.num2date(julian_day)
        for delta_year in range(1, 101): # 100 years cover several 7-year cycles
            date = converter.num2date(julian_day - delta_year * 365)

            # test that the day of the week changes by one every year (except
            # for wrapping around every 7 years, of course)
            if date.dayofwk == 6:
                self.assertEqual(old_date.dayofwk, 0)
            else:
                self.assertEqual(old_date.dayofwk - date.dayofwk, 1)

            old_date = date
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号