コード例 #1
0
 def test_util(self):
     d8e = util.today_date()
     dtime = util.today()
     assert util.format_rss_date(d8e) == d8e.strftime("%a, %d %b %Y %H:%M:%S EST")
     assert util.words_date(dtime) == dtime.strftime("%B %d, %Y")
     assert util.is_empty(" ") == True
     assert util.float_("8") == None
     assert util.page_list([1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 2) == [3, 4]
     assert util.page_list([1, 2, 3, 4, 5, 6, 7, 8, 9], None, None) == [1, 2, 3, 4, 5, 6, 7, 8, 9]
     assert util.parse_date("2012-05-06") == datetime.datetime.strptime("2012-05-06", "%Y-%m-%d")
     today_ = datetime.date.today()
     assert [today_.year + 10, today_.year + 10] in util.year_list()
     assert util.month_list()[0] == ["1", "January"]
     assert util.this_year() == datetime.date.today().year
     assert util.get_first_day(today_) == util.get_first_day(
         today_
     )  # this is pretty dumb.  it works, just get it covered.
     assert util.get_last_day(today_) == util.get_last_day(today_)
     assert util.to_uuid("ken") == None
     assert int(util.average([1, 2, 3])) == 2
     assert util.format_date(util.truncate_datetime(dtime)) == util.str_today()
     assert util.is_today(d8e) == True
コード例 #2
0
ファイル: helpers.py プロジェクト: anonymoose/pvscore
def this_year():
    return util.this_year()