Example #1
0
def test_parsing_month():
    assert_equal(period(u'2014-01'), Period((MONTH, first_jan, 1)))
Example #2
0
def test_parsing_rolling_year():
    assert period('year:2014-03') == Period((YEAR, first_march, 1))
Example #3
0
def test_parsing_month():
    assert period('2014-01') == Period((MONTH, first_jan, 1))
Example #4
0
def test_several_months():
    assert to_unicode(Period((MONTH, first_jan, 3))) == 'month:2014-01:3'
    assert to_unicode(Period((MONTH, first_march, 3))) == 'month:2014-03:3'
Example #5
0
def test_several_days():
    assert to_unicode(Period((DAY, first_jan, 3))) == 'day:2014-01-01:3'
    assert to_unicode(Period((DAY, first_march, 3))) == 'day:2014-03-01:3'
Example #6
0
def test_12_months_is_a_year():
    assert to_unicode(Period((MONTH, first_jan, 12))) == '2014'
Example #7
0
def test_several_years():
    assert to_unicode(Period((YEAR, first_jan, 3))) == 'year:2014:3'
    assert to_unicode(Period((YEAR, first_march, 3))) == 'year:2014-03:3'
Example #8
0
def test_day():
    assert str(Period((DAY, first_jan, 1))) == '2014-01-01'
Example #9
0
def test_parsing_day():
    assert period('2014-01-01') == Period((DAY, first_jan, 1))
Example #10
0
def test_year():
    assert str(Period((YEAR, first_jan, 1))) == '2014'
Example #11
0
def test_month():
    assert str(Period((MONTH, first_jan, 1))) == '2014-01'
Example #12
0
def test_parsing_several_years():
    assert_equal(period(u'year:2014:2'), Period((YEAR, first_jan, 2)))
Example #13
0
def test_parsing_several_months():
    assert_equal(period(u'month:2014-03:3'), Period((MONTH, first_march, 3)))
Example #14
0
def test_parsing_rolling_year():
    assert_equal(period(u'year:2014-03'), Period((YEAR, first_march, 1)))
Example #15
0
def test_2_years_size_in_days():
    assert Period(('year', Instant((2014, 1, 1)), 2)).size_in_days == 730
Example #16
0
def test_parsing_several_days():
    assert period('day:2014-03-01:3') == Period((DAY, first_march, 3))
Example #17
0
def test_year():
    assert to_unicode(Period((YEAR, first_jan, 1))) == '2014'
Example #18
0
def test_3_day_size_in_days():
    assert Period(('day', Instant((2014, 12, 31)), 3)).size_in_days == 3
Example #19
0
def test_rolling_year():
    assert to_unicode(Period((MONTH, first_march, 12))) == 'year:2014-03'
    assert to_unicode(Period((YEAR, first_march, 1))) == 'year:2014-03'
Example #20
0
def test_month_size_in_days():
    assert Period(('month', Instant((2014, 12, 1)), 1)).size_in_days == 31
Example #21
0
def test_month():
    assert to_unicode(Period((MONTH, first_jan, 1))) == '2014-01'
Example #22
0
def test_leap_month_size_in_days():
    assert Period(('month', Instant((2012, 2, 3)), 1)).size_in_days == 29
Example #23
0
def test_day():
    assert to_unicode(Period((DAY, first_jan, 1))) == '2014-01-01'
Example #24
0
def test_3_month_size_in_days():
    assert Period(('month', Instant(
        (2013, 1, 3)), 3)).size_in_days == 31 + 28 + 31
Example #25
0
def test_parsing_year():
    assert period('2014') == Period((YEAR, first_jan, 1))
Example #26
0
def test_leap_3_month_size_in_days():
    assert Period(('month', Instant(
        (2012, 1, 3)), 3)).size_in_days == 31 + 29 + 31
Example #27
0
def test_parsing_several_years():
    assert period('year:2014:2') == Period((YEAR, first_jan, 2))
Example #28
0
def test_leap_year_size_in_days():
    assert Period(('year', Instant((2012, 1, 1)), 1)).size_in_days == 366
Example #29
0
def test_parsing_several_months():
    assert period('month:2014-03:3') == Period((MONTH, first_march, 3))
Example #30
0
def test_parsing_year():
    assert_equal(period(u'2014'), Period((YEAR, first_jan, 1)))