Esempio n. 1
0
def test_is_autumn_for_southern_hemisphere(months):
    """Test returns true for autumn months on the southern hemisphere"""

    assert season_info(months.january, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.february, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.march, Hemisphere.SOUTHERN).is_autumn is True
    assert season_info(months.april, Hemisphere.SOUTHERN).is_autumn is True
    assert season_info(months.may, Hemisphere.SOUTHERN).is_autumn is True
    assert season_info(months.june, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.july, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.august, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.september,
                       Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.october, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.november, Hemisphere.SOUTHERN).is_autumn is False
    assert season_info(months.december, Hemisphere.SOUTHERN).is_autumn is False
print(info.types)
# {<TimeType.AFTERNOON: 'afternoon'>}

print(info.is_afternoon)
# True

print(info.is_evening)
# False

print(info.is_weekend)
# AttributeError: 'DayTimeInfo' object has no attribute 'is_weekend'


# Asking for the season e.g. in summer on the southern hemisphere:
info = season_info(now, Hemisphere.SOUTHERN)

print(info.types)
# {<TimeType.SUMMER: 'summer'>}

print(info.is_spring)
# False

print(info.is_summer)
# True

print(info.is_autumn)
# False

print(info.is_winter)
# False
Esempio n. 3
0
def test_is_spring_for_northern_hemisphere(months):
    """Test returns true for spring months on the northern hemisphere"""

    assert season_info(months.january, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.february, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.march, Hemisphere.NORTHERN).is_spring is True
    assert season_info(months.april, Hemisphere.NORTHERN).is_spring is True
    assert season_info(months.may, Hemisphere.NORTHERN).is_spring is True
    assert season_info(months.june, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.july, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.august, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.september,
                       Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.october, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.november, Hemisphere.NORTHERN).is_spring is False
    assert season_info(months.december, Hemisphere.NORTHERN).is_spring is False