コード例 #1
0
ファイル: dateandtime.py プロジェクト: akesandgren/vsc-base
    def test_fancymonth(self):
        """Test some of the FancyMonth functions"""
        today = datetime.date.today()
        endapril = datetime.date(today.year, 4, 10)
        f = FancyMonth(endapril)
        self.assertEqual(f.nrdays, 30)  # nr days in month

        may2nd = datetime.date(today.year, 5, 2)
        self.assertEqual(f.number(may2nd), 2)  # spans 2 months
        self.assertEqual([x.nrdays for x in f.interval(may2nd)], [30, 31])  # interval returns FancyMonth instances
コード例 #2
0
    def test_fancymonth(self):
        """Test some of the FancyMonth functions"""
        today = datetime.date.today()
        endapril = datetime.date(today.year, 4, 10)
        f = FancyMonth(endapril)
        self.assertEqual(f.nrdays, 30)  # nr days in month

        may2nd = datetime.date(today.year, 5, 2)
        self.assertEqual(f.number(may2nd), 2)  # spans 2 months
        self.assertEqual([x.nrdays for x in f.interval(may2nd)], [30, 31])  # interval returns FancyMonth instances
コード例 #3
0
ファイル: dateandtime.py プロジェクト: akesandgren/vsc-base
#    print date_parser('1970-1-1') == testdate
#
#    today = datetime.date.today()
#    beginthismonth = datetime.date(today.year, today.month, 1)
#    print date_parser('BEGINTHISMONTH') == beginthismonth
#
#    endapril = datetime.date(today.year, 4, 30)
#    print date_parser('ENDAPRIL') == endapril

#    # datetime_parser
#    testdate = datetime.datetime(1970, 1, 1)
#    print datetime_parser('1970-01-01') , testdate
#    print datetime_parser('1970-1-1'), testdate
#
#    today = datetime.datetime.today()
#    beginthismonth = datetime.datetime(today.year, today.month, 1, 12, 1)
#    print datetime_parser('BEGINTHISMONTH 12:1') , beginthismonth
#
#    endapril = datetime.datetime(today.year, 4, 30, 12, 1, 1, 1)
#    print datetime_parser('ENDAPRIL 12:01:01.000001') , endapril

    ## FancyMonth
    today = datetime.date.today()
    endapril = datetime.date(today.year, 4, 10)
    f = FancyMonth(endapril)
    print f.nrdays, 30  # nr days in month

    may2nd = datetime.date(today.year, 5, 2)
    print f.number(may2nd), 2  # spans 2 months
    print [x.nrdays for x in f.interval(may2nd)], [30, 31]  # interval returns FancyMonth instances
コード例 #4
0
    #
    #    today = datetime.date.today()
    #    beginthismonth = datetime.date(today.year, today.month, 1)
    #    print date_parser('BEGINTHISMONTH') == beginthismonth
    #
    #    endapril = datetime.date(today.year, 4, 30)
    #    print date_parser('ENDAPRIL') == endapril

    #    # datetime_parser
    #    testdate = datetime.datetime(1970, 1, 1)
    #    print datetime_parser('1970-01-01') , testdate
    #    print datetime_parser('1970-1-1'), testdate
    #
    #    today = datetime.datetime.today()
    #    beginthismonth = datetime.datetime(today.year, today.month, 1, 12, 1)
    #    print datetime_parser('BEGINTHISMONTH 12:1') , beginthismonth
    #
    #    endapril = datetime.datetime(today.year, 4, 30, 12, 1, 1, 1)
    #    print datetime_parser('ENDAPRIL 12:01:01.000001') , endapril

    ## FancyMonth
    today = datetime.date.today()
    endapril = datetime.date(today.year, 4, 10)
    f = FancyMonth(endapril)
    print f.nrdays, 30  # nr days in month

    may2nd = datetime.date(today.year, 5, 2)
    print f.number(may2nd), 2  # spans 2 months
    print[x.nrdays for x in f.interval(may2nd)
          ], [30, 31]  # interval returns FancyMonth instances
コード例 #5
0
#    print date_parser('1970-1-1') == testdate
#
#    today = datetime.date.today()
#    beginthismonth = datetime.date(today.year, today.month, 1)
#    print date_parser('BEGINTHISMONTH') == beginthismonth
#
#    endapril = datetime.date(today.year, 4, 30)
#    print date_parser('ENDAPRIL') == endapril

#    # datetime_parser
#    testdate = datetime.datetime(1970, 1, 1)
#    print datetime_parser('1970-01-01') , testdate
#    print datetime_parser('1970-1-1'), testdate
#
#    today = datetime.datetime.today()
#    beginthismonth = datetime.datetime(today.year, today.month, 1, 12, 1)
#    print datetime_parser('BEGINTHISMONTH 12:1') , beginthismonth
#
#    endapril = datetime.datetime(today.year, 4, 30, 12, 1, 1, 1)
#    print datetime_parser('ENDAPRIL 12:01:01.000001') , endapril

    ## FancyMonth
    today = datetime.date.today()
    endapril = datetime.date(today.year, 4, 10)
    f = FancyMonth(endapril)
    print f.nrdays, 30  # nr days in month

    may2nd = datetime.date(today.year, 5, 2)
    print f.number(may2nd), 2  # spans 2 months
    print [x.nrdays for x in f.interval(may2nd)], [30, 31]  # interval returns FancyMonth instances