def test_parsing_month(): assert_equal(period(u'2014-01'), Period((MONTH, first_jan, 1)))
def test_parsing_rolling_year(): assert period('year:2014-03') == Period((YEAR, first_march, 1))
def test_parsing_month(): assert period('2014-01') == Period((MONTH, first_jan, 1))
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'
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'
def test_12_months_is_a_year(): assert to_unicode(Period((MONTH, first_jan, 12))) == '2014'
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'
def test_day(): assert str(Period((DAY, first_jan, 1))) == '2014-01-01'
def test_parsing_day(): assert period('2014-01-01') == Period((DAY, first_jan, 1))
def test_year(): assert str(Period((YEAR, first_jan, 1))) == '2014'
def test_month(): assert str(Period((MONTH, first_jan, 1))) == '2014-01'
def test_parsing_several_years(): assert_equal(period(u'year:2014:2'), Period((YEAR, first_jan, 2)))
def test_parsing_several_months(): assert_equal(period(u'month:2014-03:3'), Period((MONTH, first_march, 3)))
def test_parsing_rolling_year(): assert_equal(period(u'year:2014-03'), Period((YEAR, first_march, 1)))
def test_2_years_size_in_days(): assert Period(('year', Instant((2014, 1, 1)), 2)).size_in_days == 730
def test_parsing_several_days(): assert period('day:2014-03-01:3') == Period((DAY, first_march, 3))
def test_year(): assert to_unicode(Period((YEAR, first_jan, 1))) == '2014'
def test_3_day_size_in_days(): assert Period(('day', Instant((2014, 12, 31)), 3)).size_in_days == 3
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'
def test_month_size_in_days(): assert Period(('month', Instant((2014, 12, 1)), 1)).size_in_days == 31
def test_month(): assert to_unicode(Period((MONTH, first_jan, 1))) == '2014-01'
def test_leap_month_size_in_days(): assert Period(('month', Instant((2012, 2, 3)), 1)).size_in_days == 29
def test_day(): assert to_unicode(Period((DAY, first_jan, 1))) == '2014-01-01'
def test_3_month_size_in_days(): assert Period(('month', Instant( (2013, 1, 3)), 3)).size_in_days == 31 + 28 + 31
def test_parsing_year(): assert period('2014') == Period((YEAR, first_jan, 1))
def test_leap_3_month_size_in_days(): assert Period(('month', Instant( (2012, 1, 3)), 3)).size_in_days == 31 + 29 + 31
def test_parsing_several_years(): assert period('year:2014:2') == Period((YEAR, first_jan, 2))
def test_leap_year_size_in_days(): assert Period(('year', Instant((2012, 1, 1)), 1)).size_in_days == 366
def test_parsing_several_months(): assert period('month:2014-03:3') == Period((MONTH, first_march, 3))
def test_parsing_year(): assert_equal(period(u'2014'), Period((YEAR, first_jan, 1)))